I'm not fully understanding how to customise MaterialUI components. After reading through the dos https://material-ui.com/customization/components/ I understand how to customise using classes and className. I don't understand the advanced techniques - really confusing.
Here is an example I've found on codesandbox on customising TextFields https://codesandbox.io/s/6rx8p?file=/demo.tsx:842-858
e.g.
const CssTextField = withStyles({
root: {
'& label.Mui-focused': {
color: 'green',
},
'& .MuiInput-underline:after': {
borderBottomColor: 'green',
},
'& .MuiOutlinedInput-root': {
'& fieldset': {
borderColor: 'red',
},
'&:hover fieldset': {
borderColor: 'yellow',
},
'&.Mui-focused fieldset': {
borderColor: 'green',
},
},
},
})(TextField);
From the above example where does the property fieldset. I can't seen to find anywhere in the doc about the prop fieldset. Even looking through Chrome Dev tools I can't see where this property comes from.
How do you figure out which property does what. Is there and easy way to understand this with some example.
Is there a tutorial I can go through?
fieldsetis not a TextFields's property but a html tag from other component. if you check at Chrome Dev tools you can find<fieldset>with some css class.TextFields is composed from other smaller components as you can check text-fields - components.
fieldsetcomes from the small component OutlinedInput. it has the global css classMuiOutlinedInput-notchedOutlinewhich you can find it at you css list.you can check at github OutlinedInput implementation.
fieldsetcomes from NotchedOutline.js.As you said, it's not explicit in the documentation. it doesn't list the tag elements composing a given component. It required me some investigation to dig deeper to find out its structure.