Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

298
Visualizações
Material UI change date field style in dialog

I'm using Material-UI in my React project, and using its date picker component to render date items. but the default style is not suitable for my need, i want to use selector as a date displayment in date picker dialog, replacing its text field. After viewing Material-UI's date picker related API, I cannot find suitable ways. Can any help? that will be very helpfull.

Following picture is the date picker style I want to render:

wanted style

Following picture is its default style, the default is text:

default style

the code as following:

import { useState } from "react";
import { makeStyles } from "@material-ui/styles";
import { MuiPickersUtilsProvider, KeyboardDatePicker } from "@material-ui/pickers";
import DateFnsUtils from "@date-io/date-fns";

const useStyle = makeStyles({
  root: {
    marginBottom: "3rem",
  },
});

const CustomizeDatePicker = () => {
  const classes = useStyle();
  const [selectedDate, setSelectedDate] = useState(new Date());

  return (
    <div className={classes.root}>
      <MuiPickersUtilsProvider utils={DateFnsUtils}>
        <KeyboardDatePicker
          autoOk
          label="end date"
          format="yyyy-MM-dd"
          views={["year", "month", "date"]}
          openTo="date"
          value={selectedDate}
          onChange={setSelectedDate}
        />
      </MuiPickersUtilsProvider>
    </div>
  );
};

export default CustomizeDatePicker;

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

First off, 3rd party libraries usually not that flexible as you want them to be. If it is styling only, it can be overwritten with your css using their class names and styled accordingly. Sadly when it comes to functionality, whatever they expose, you can use it. On rare cases, they allow to prototype their components with extended functionality, but this is not the case right here.

I'd suggest using https://material-ui-pickers.dev/ as material-ui even suggests it, because of extended functionality.

Then look at their API and what it can do https://material-ui-pickers.dev/api/DatePicker

The only possible solution for you, is creating your own date picker.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda