Checkbox & Radio style props are not applied consistently
See original GitHub issueDescription
When styling Checkbox
& Radio
components using the same style props, I expected a similar visual appearance but it’s currently not the case.
Link to Reproduction
https://codesandbox.io/s/eloquent-hoover-g4s8f
Steps to reproduce
By adding the background
or borderColor
props to the Checkbox
& Radio
components.
Chakra UI Version
1.6.4
Browser
Chrome 91
Operating System
- macOS
- Windows
- Linux
Additional Information
In the case of Checkbox
, the style props are properly applied to the container
part of the component. While with Radio
, styles are applied to the control
directly.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14
Top Results From Across the Web
checkbox not coming properly in react form - Stack Overflow
I am using below css for it. I did lot of changes in this combinatioon but nothing is working. how can I make...
Read more ><input type="checkbox"> - HTML: HyperText Markup Language
A checkbox allows you to select single values for submission in a form (or not). Try it. HTML Demo: <input type="checkbox">. Reset.
Read more >Checkbox | Primer React
Individual checkboxes do not have validation styles. value, string, A unique value that is never shown to the user. Used during form submission ......
Read more >Checks Radios - React-Bootstrap
Create consistent cross-browser and cross-device checkboxes and radios with our completely rewritten checks component. For the non-textual checkbox and radio ...
Read more >React Radio Group component - Material UI - MUI
When a label can't be used, it's necessary to add an attribute directly to the input component. In this case, you can apply...
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
@simontaisne the docs have an example on creating your own custom radio component!
i think this could be remedied by setting
height = 'fit-content'
as well so that theBox
is exactly the size of the checkbox component + label and then clicking on theBox
should update the state of the radio! (see here) I do have to say that this behaviour (usingBox
as a workaround) is less than ideal though 😕i think that this issue should be addressed primarily by bringing the component styling in line with what checkbox does (assuming that it’s not an issue to do so) and depending on the reply, a follow up PR to bring radio/checkbox behaviour to be identical.
i can take a look at this! just to be sure i’m understanding you correctly, you’d expect the container for the
radio
to also have css styling applied to it right? (i.e, looks identical to checkbox)