question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checkbox & Radio style props are not applied consistently

See original GitHub issue

Description

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:open
  • Created 2 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
seaerchincommented, Jul 22, 2021

@simontaisne the docs have an example on creating your own custom radio component!

The issue here is that clicking the Box won’t update the state of the Radio

i think this could be remedied by setting height = 'fit-content' as well so that the Box is exactly the size of the checkbox component + label and then clicking on the Box should update the state of the radio! (see here) I do have to say that this behaviour (using Box 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.

1reaction
seaerchincommented, Jul 22, 2021

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found