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

[FormControlLabel] Support required #34198

Closed
2 tasks done
emlai opened this issue Sep 5, 2022 · 3 comments · Fixed by #34207
Closed
2 tasks done

[FormControlLabel] Support required #34198

emlai opened this issue Sep 5, 2022 · 3 comments · Fixed by #34207
Assignees
Labels
component: FormControl The React component new feature New feature or request

Comments

@emlai
Copy link
Contributor

emlai commented Sep 5, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Implementing a labeled checkbox with a "required" asterisk, such as the following, is currently not possible without workarounds:

image

This would normally be coded like this:

<FormControlLabel required label={label} control={<Checkbox />} />

but FormControlLabel doesn't support the required prop.

Expected behavior 🤔

FormControlLabel supports the required prop.

Steps to reproduce 🕹

No response

Context 🔦

Related issues:

We would be willing to contribute this feature, if this gets the green light.

Your environment 🌎

No response

@emlai emlai added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 5, 2022
@hbjORbj hbjORbj added the component: FormControl The React component label Sep 5, 2022
@michaldudak
Copy link
Member

@oliviertassinari I must admit even I'm confused here given the multitude of options we have (FormControlLabel vs FormLabel). The demo you point to in #11038 (comment) doesn't exist anymore, and we don't show required fields in either Radio, Checkbox, or Switch docs.

@michaldudak michaldudak added new feature New feature or request and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 13, 2022
@MaEdAlpha
Copy link

Just wanted to add in to the confusion. There is an example in your documentation, but it doesn't work if you nest a JSX element within the label prop.

image

@michaldudak
Copy link
Member

@MaEdAlpha, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: FormControl The React component new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants