Adding support for _checked state selector to Checkbox container
See original GitHub issueDescription
It can be useful to be able to set the container style of a <Checkbox/> depending on whether or not it’s checked. For example, changing the background to make the checked state stand out.
Problem Statement/Justification
Some design systems may require being able to change the container styling depending on the checked state.
Also makes sense to add for a more consistent API as both the control
and label
parts seem to support a _checked
state.
Proposed Solution or API
Something like
{
baseStyle: {
container: {
_checked: {
bg: 'red.200'
}
}
}
}
Alternatives
Currently making a custom <Checkbox/> component.
Additional Information
Example:
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
checked - CSS: Cascading Style Sheets - MDN Web Docs
The :checked CSS pseudo-class selector represents any radio ( ), checkbox ( ), or option ( in a ) element that is checked...
Read more >How To Select The Check Box In Selenium With Examples
#1) Checked: State in which the Checkbox is selected is the checked state. Here, we can see the box as tick marked. #2)...
Read more >checked - CSS-Tricks
The :checked pseudo-class selector matches radio and checkbox input types when checked or toggled to an on state.
Read more >Building a custom checkbox in React - LogRocket Blog
Later on this page, we will define logic that lets us pass the initial state into the Checkbox component, whether we want it...
Read more >Tri-state Check box in HTML? - Stack Overflow
It will require some javascript and a CSS class. Here I put a particular example that handles a list with checkable items and...
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
@codetheweb Yes, it still stands and I think it’s a valid use-case.
I’ve just added support for this. It’ll be available in the next release.
Oh…but the Checkbox doesn’t have a container part