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
How can we supply default props to these controls?
One of the reasons we need to do this is that we have a customized MUI TextField component (we create a wrapper component around MUI's TextField) that we need every instance of these pickers to use. This will ensure our theming and behavior customizations on the TextField will be consistent for all TextFields across our app.
So far I have been able to pass-in our custom TextField component via the TextFieldComponent prop. But obviously that's not very DRY to have to do that on every single instance. And we need to set it up so that other developers don't have to remember to pass that in every time.
We accomplish default props with our other MUI controls by using their built-in theming system. They have a props key (on the theme object) that can be utilized to set such default prop values. See this section of their docs.
So far I have tried to accomplish setting some default props for these picker controls by specifying a proper key in the theme object. I can't seem to tell which key to use to affect the component which renders the TextField, so for now I'm just trying several possible MUI Pickers keys (none of which are working):
Summary
So how do we set default props on these controls?
The text was updated successfully, but these errors were encountered:
@jasonkylefrank Thanks for the report, you are right, we miss the support for default props. We should 1. use withStyles over makeStyles, 2. provide a name to the stylesheets.
Environment
Question / issue
How can we supply default props to these controls?
One of the reasons we need to do this is that we have a customized MUI TextField component (we create a wrapper component around MUI's TextField) that we need every instance of these pickers to use. This will ensure our theming and behavior customizations on the TextField will be consistent for all TextFields across our app.
So far I have been able to pass-in our custom TextField component via the
TextFieldComponent
prop. But obviously that's not very DRY to have to do that on every single instance. And we need to set it up so that other developers don't have to remember to pass that in every time.We accomplish default props with our other MUI controls by using their built-in theming system. They have a
props
key (on the theme object) that can be utilized to set such default prop values. See this section of their docs.So far I have tried to accomplish setting some default props for these picker controls by specifying a proper
key
in the theme object. I can't seem to tell whichkey
to use to affect the component which renders the TextField, so for now I'm just trying several possible MUI Pickers keys (none of which are working):Summary
So how do we set default props on these controls?
The text was updated successfully, but these errors were encountered: