Sometimes, we want to style React Material UI text field with JavaScript.
In this article, we’ll look at how to style React Material UI text field with JavaScript.
How to style React Material UI text field with JavaScript?
To style React Material UI text field with JavaScript, we can use the sx
or inputProps
prop.
For instance, we write
<TextField sx={{ marginTop: 10 }} inputProps={{ sx: { color: "#fff" } }} />;
to set the sx
prop to an object with the styles for the text field.
We also set inputProps
to an object with the sx
property set to an object with the styles to style the text field.
Conclusion
To style React Material UI text field with JavaScript, we can use the sx
or inputProps
prop.