Booleans in Radio groups
See original GitHub issue- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
Since 3.2.1 Radio elements can have a boolean value. Great! Have been waiting for this functionality for a while. Tested it immediately and found some issues:
- FormControlLabel should support numbers & booleans now as well. This gives a warning now.
<FormControlLabel
value={false}
control={<Radio />}
label="green"
/>
- When using the boolean values, the value in
onChange
function of RadioGroup gets transformed to String anyway.
Your Environment
Tech | Version |
---|---|
Material-UI | v3.2.1 |
React | latest |
Browser | Chrome |
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Booleans in Radio groups #13250 - mui/material-ui - GitHub
Since 3.2.1 Radio elements can have a boolean value. Great! Have been waiting for this functionality for a while.
Read more >ReactJS: How to use boolean values in radio buttons?
What is the proper way to use boolean data in radio buttons. The values will be converted from booleans to strings if used...
Read more ><input type="radio"> - HTML: HyperText Markup Language
A Boolean attribute which, if present, indicates that this radio button is the default selected one in the group. Unlike other browsers, ...
Read more >Radio Button group with boolean binding shows defaut as ...
Hi ALL,. I have a radio button group with boolean variable binding. Even though variable is initialized by default false(No) is showing in...
Read more >How can I store a radio button value as a boolean?
You can set boolean values to display as 1 = yes and 0 = no, but unfortunately you can't do this with radio...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@karensg The idea behind #13173 was to allow people have the native input do the type casting to a string. We try not to be opinionated around how the native input behaves. Another way to see it, is that we trust React for having picked the best tradeoff. I can easily imagine the behavior you are looking for being rolled out to all React users. Thanks for raising the concern.
I struggled a bit with React Hook Form + Zod, since I wanted to manage booleans in my business logic, but the templating was messing with strings.
Don’t know if it can help but here my “workaround”: https://stackoverflow.com/a/74854174/3608410