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

263
Visualizações
How to change MUI TimePicker component label color

I am using MUI v5. I have made a form to choose fighters but I am stuck trying to override the label color of the TimePicker component. All my other form components have the normal color I want but I can't figure out how to change the color of the TimePicker.

enter image description here

The TimePicker component is not focused in the image. When I select the other form components the color changes to red, like it should but TimePicker stays red the entire time focused or not.

I have tried changing my theme colors, I have used

inputProps={{ className: classes.input }}

within the component and successfully changed the text color and background of the TimePicker but can't find the proper CSS to change the label color.

In my code you can see I have tried to override the .root and .floatingLabelFocusStyle but to no avail.

import { makeStyles, TextField } from "@material-ui/core";
import { LocalizationProvider, TimePicker } from "@mui/lab";
import AdapterDateFns from "@mui/lab/AdapterDateFns";
import { useState } from "react";

const useStyles = makeStyles((theme) => ({
  input: {
    color: 'blue'
  },
  floatingLabelFocusStyle: {
    
  },
  root: {
    color: 'blue'
  }
}));

const GameTimePicker = ({ setFormGameTime, currentTime = '' }) => {

  const classes = useStyles();
  
  const [gameTime, setGameTime] = useState(currentTime);

  const handleChange = (e, v) => {
    // console.log(v);
    setGameTime(v);
    setFormGameTime(v);
  }

  return (
    <LocalizationProvider dateAdapter={AdapterDateFns}>
      <TimePicker
          ampm={false}
          views={['minutes', 'seconds']}
          inputProps={{ className: classes.input }}
          color='success'
          inputFormat="mm:ss"
          mask="__:__"
          label="Time of fight/event"
          value={gameTime}
          onChange={handleChange}
          renderInput={(params) => <TextField {...params} />}
      />
    </LocalizationProvider>
  )
}

export default GameTimePicker;

Any ideas how I can override this color?

about 4 years ago · Juan Pablo Isaza
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