Skip to content
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

Merged
merged 3 commits into from
Apr 1, 2022

Conversation

michaldudak
Copy link
Member

@michaldudak michaldudak commented Mar 31, 2022

Created new content for the FormControlUnstyled page in Base docs.

Preview - https://deploy-preview-32073--material-ui.netlify.app/base/react-form-control/

@michaldudak michaldudak requested a review from a team March 31, 2022 07:50
@michaldudak michaldudak added the docs Improvements or additions to the documentation label Mar 31, 2022
@mui-bot
Copy link

mui-bot commented Mar 31, 2022

No bundle size changes

Generated by 🚫 dangerJS against 3611954

useFormControlUnstyled,
} from '@mui/base/FormControlUnstyled';

function CustomInput() {
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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. |
Copy link
Member

@hbjORbj hbjORbj Mar 31, 2022

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}}
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@hbjORbj hbjORbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@michaldudak michaldudak merged commit a8f62b6 into mui:master Apr 1, 2022
@michaldudak michaldudak deleted the docs/form-control branch April 1, 2022 13:48
@oliviertassinari
Copy link
Member

We had a rebase issue with this one (which is fine and part of our workflow's tradeoff). Fixed in f849759.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants