You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most MUI components have a classes prop that is used to set class names of MUI's internal sub-components (or for specific pseudo-selectors or component states). The allowed rule names vary per component.
Here's the JS native API:
<Buttonclasses={{root: "foo"label: "bar"}}>
Here's an example of the view DSL with the classes prop:
But this of course causes problems in the prop generation, since classes is a sub-object.
I had an early hack going where I used prop names like "classes.root", and when creating the prop object from the IReactProperty list I extracted props with . in the name, split them on . and created a sub-object. The API was nice, but I was concerned about performance since this was done for every single prop list in the whole app. (I didn't measure anything, though.) Inputs on this approach are welcome.
The text was updated successfully, but these errors were encountered:
Most MUI components have a
classes
prop that is used to set class names of MUI's internal sub-components (or for specific pseudo-selectors or component states). The allowed rule names vary per component.Here's the JS native API:
Here's an example of the view DSL with the
classes
prop:The
button.classes
prop is defined like this:https://github.com/cmeeren/Feliz.MaterialUI/blob/adb43cba1d6b9aea2153da32a9987d608159ed92/src/Feliz.MaterialUI/Props.fs#L338
The actual classes are defined like this:
https://github.com/cmeeren/Feliz.MaterialUI/blob/adb43cba1d6b9aea2153da32a9987d608159ed92/src/Feliz.MaterialUI/Classes.fs#L116-L123
With a design like this, it's impossible to use incorrect rule names.
Is this design and implementation OK?
Ideally, I'd like to flatten it:
But this of course causes problems in the prop generation, since
classes
is a sub-object.I had an early hack going where I used prop names like
"classes.root"
, and when creating the prop object from theIReactProperty list
I extracted props with.
in the name, split them on.
and created a sub-object. The API was nice, but I was concerned about performance since this was done for every single prop list in the whole app. (I didn't measure anything, though.) Inputs on this approach are welcome.The text was updated successfully, but these errors were encountered: