I want to make collection of all MUI(v5) sx
props out side of component. like following
const styles = { // HOW TO TYPE THIS VARIABLE
sectionOne: { // type of SXProps<Theme>
},
// ...
};
const Component: = () => {
return (
<>
<Box sx={styles.sectionOne}></Box>
// ....
</>
)
}
I've created following type
type StylesCollection = {
[key: string]: SxProps<Theme>
};
This helps when writing inside styles
, but doesn't autocompletes when using that.
In this scenario how to type the styles
variable, so autosuggest is available when using it (in component / elements sx
prop. Like using in the Box
component above.