Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

355
Vistas
Changing the Material UI's DatePicker's border color

enter image description here

This is my DatePicker from material UI, the only thing I want is to change borderColor. I've tried classes, changing the theme's primary color, using WithStyles.. Nothing seems to work.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The className prop is not applied to the MUI DatePicker component currently. There is an open issue on GitHub for this bug.

Alternatively, you can pass className prop to renderInput prop like:

<DatePicker
    label="Birthdate"
    defaultValue={new Date()}
    renderInput={(params) => (
      <TextField {...params} className="myDatePicker" />
    )}
/>

and apply the css on fieldset tag like:

.myDatePicker fieldset.MuiOutlinedInput-notchedOutline {
  border-color: green;
}

.myDatePicker .Mui-focused fieldset.MuiOutlinedInput-notchedOutline {
  border-color: red;
}

You can take a look at this sandbox for a live working example of this usage.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Here is a way to customise the default, hover and active styling for the border color. You can also do the same using styled components. Here is a working codesandbox.

<DatePicker
        label="Birthdate"
        defaultValue={new Date()}
        renderInput={(params) => (
          <TextField
            {...params}
            sx={{
              '& .MuiOutlinedInput-root': {
                '& fieldset': {
                  borderColor: 'red',
                },
                '&:hover fieldset': {
                  borderColor: 'green',
                },
                '&.Mui-focused fieldset': {
                  borderColor: 'purple',
                },
              },
            }}
          />
        )}
      />
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda