-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Create the FormControl page #32073
Conversation
useFormControlUnstyled, | ||
} from '@mui/base/FormControlUnstyled'; | ||
|
||
function CustomInput() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this demo nicely shows the usage, I think it would be useful to create a more "real life" example maybe using the InputUnstyled
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I say more "real life" I mean input with some validation and error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added another demo with InputUnstyled.
|
||
| Name | Type | Description | | ||
| ---------- | ------------------------- | ------------------------------------------------------------- | | ||
| `onChange` | React.ChangeEvent => void | Change handler. Should be forwarded to the inner input. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Value change handler
is more descriptive?
`CustomInput` is a wrapper around a native HTML `input` that adds FormControlUnstyled integration. | ||
`ControlStateDisplay` reads the state of the form control and displays it as text. | ||
|
||
{{"demo": "UseFormControl.js", "defaultCodeOpen": false}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Since we have only 1 demo in this page, we can show the code by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided not to show it as the code in the preview does not explain the concept. It's the code outside the main function that matters in this case.
Co-authored-by: Benny Joo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍
We had a rebase issue with this one (which is fine and part of our workflow's tradeoff). Fixed in f849759. |
Created new content for the FormControlUnstyled page in Base docs.
Preview - https://deploy-preview-32073--material-ui.netlify.app/base/react-form-control/