[CheckBox] isChecked prop is not affecting the checked state
See original GitHub issueDescribe the bug The CheckBox isChecked prop is not affecting the checked state of the checkbox.
Expected Behavior Expect the CheckBox to be checked when isChecked prop is set to true.
To Reproduce
- Create a CheckboxGroup
- Create a CheckBox inside the CheckboxGroup
- Set isChecked={true}
import { CheckboxGroup, Checkbox } from '@chakra-ui/core'
<CheckboxGroup name="MyCheckBoxGroup">
<Checkbox value="test" isChecked={true}>
Test
</Checkbox>
</CheckboxGroup>
Desktop (please complete the following information):
- macOS Catalina 10.15.1
- Firefox 70.0.1 64-bit
- Chrome 78.0.3904.108
- “@chakra-ui/core”: “^0.5.0”
I’ve tried passing the onChange prop as well, since isCheck={true} makes the component controlled, as specified in the docs.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Checkbox not Rendering or Changing Checked value when ...
I have used property 'checked' and assigned state's boolean value. So, it should render when state going to be changed but it not...
Read more >How to check whether a checkbox is checked in jQuery?
prop (): This method provides an simple way to track down the status of checkboxes. It works well in every condition because every...
Read more >Checkbox API - Material UI - MUI
API reference docs for the React Checkbox component. Learn about the props, CSS, and other APIs of this exported module.
Read more >Telerik Web Forms Checked State - RadCheckBox
You can get/set the checked state of the RadCheckBox control on the server-side through the Checked property. The Checked property takes a nullable...
Read more >QCheckBox Class | Qt Widgets 6.4.1
You can use isChecked() to query whether or not a checkbox is checked. ... This property holds whether the checkbox is a tri-state...
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
From reading the docs, I believe when using a
<CheckboxGroup />
the checks are determined at the group level.You want to do:
https://chakra-ui.com/checkbox#checkboxgroup-props
Arghh… 😱 You should really mention this in big red letters in the updated documentation of the CheckBox element, because it’s not there anymore and i’ve literally spent days (and weeks between) trying to figure out why none of these worked :
isChecked
,defaultIsChecked
,defaultChecked
andonChange
(?) It’s not obvious that these properties should stop working when inside a container ! Cheers,