Mark material-ui fields as required based on the yup schema #3168
Unanswered
petermiles
asked this question in
Ideas
Replies: 2 comments
-
you have a codesandbox, not sure if i am following. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think this is not possible on RHF level. For example, we have a Yup schema with some fields being required or not depending on other field values. Something similar we do is depending on |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We have a bunch of fields in our app that we want to mark as required. We'd like to utilize the
required
prop in material-ui to manage adding an asterisk or not based on if it's required.Ideally we could pass in whatever yup schema to the
resolver
prop ofuseForm
and react-hook-form would add therequired
prop to whatever field we are using. I see this could being an issue because RHF really just manages the inputRef, not the component itself so it wouldn't know anything about the MUI components we are using.Got any ideas?
Beta Was this translation helpful? Give feedback.
All reactions