Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Change MUI Text color of TextField Component

So the code is this:

                        <TextField
                          required
                          id="outlined-select-currency"
                          select
                          label="Client Type"
                          value={currency}
                          onChange={handleChange}
                          sx={{ '& input' : {color: 'white'}, '& label.Mui-focused': { color: 'white' }, '& label' : {color: 'white'} }}
                        >
                          {currencies.map((option) => (
                            <MenuItem key={option.value} value={option.value}
                            >
                              {option.label}
                            </MenuItem>
                          ))}
                        </TextField>

and the result is this:

enter image description here enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

But when you select from the dropdown you get this:

enter image description here

Does anyone know what class should I override to change the text color?
(on other the sx{} work just fine, but here using the it doesn’t.

enter image description here

Thanks for the help.

>Solution :

The class name is .MuiInputBase-input on which you can set color: "yourColor"

<TextField             
    sx={{ '& .MuiInputBase-input': { color: 'white' } }}
/>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading