Skip to content
Advertisement

How to change material-ui Textfield label styles in react

I’m new to Material-UI, I couldn’t able to figure it out, how to change the color of the label which is showing in grey color. I want it in black. Can anyone help me with this query?

Here is the Code :

JavaScript

Here is the code: “https://codesandbox.io/s/fancy-morning-30owz

Advertisement

Answer

If you use the selection tools in your browser, you would find out that:

The class name used is MuiFormLabel-root

JavaScript

So set the styles using nesting selector to the TextField component

Functional component

JavaScript

Classical component

JavaScript

usage

JavaScript

By this way, you can change the label color, as the screenshot is shown below (currently red)


enter image description here


Try it online:

Edit staging-framework-3h4m8

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement