npx gluestack-ui add checkboximport { Checkbox } from '@/components/ui/checkbox';


export default () => (
<CheckboxGroup>
<Checkbox>
<CheckboxIndicator>
<CheckboxIcon />
</CheckboxIndicator>
<CheckboxLabel />
</Checkbox>
</CheckboxGroup>
);
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | The value to be used in the checkbox input. This is the value that will be returned on form submission. |
onChange | (value: boolean) => void | - | Function called when the state of the checkbox changes. |
defaultIsChecked | bool | false | If true, the checkbox will be initially checked. |
isChecked | bool | false | When true, the checkbox will be checked. You'll need to pass onChange to update it's value (since it's now controlled). |
isDisabled | bool | false | To manually set disable to the checkbox. |
isInvalid | bool | false | To manually set invalid to the checkbox. |
isReadOnly | bool | false | To manually set read-only to the checkbox. |
isHovered | bool | false | To manually set hover to the checkbox. |
isFocusVisible | bool | false | To manually set focus visible state to the checkbox. |
isIndeterminate | bool | false | To manually set indeterminate to the checkbox. |
| Prop | Type | Default | Description |
|---|---|---|---|
forceMount | boolean | false | Forces mounting when more control is needed, useful for animations with React libraries. |
| Prop | Type | Default | Description |
|---|---|---|---|
value | string[] | - | The value of the checkbox group. |
onChange | (values: Array<string>) => void | - | The callback fired when any children Checkbox is checked or unchecked. |
isDisabled | bool | false | To manually set disable to the checkbox. |
isInvalid | bool | false | To manually set invalid to the checkbox. |
isReadOnly | bool | false | To manually set read-only to the checkbox. |
| Name | Value | Default |
|---|---|---|
size | lg | md | sm | md |
| State | Data Attribute | Values |
|---|---|---|
hover | data-hover | true | false |
active | data-active | true | false |
disabled | data-disabled | true | false |
focusVisible | data-focus-visible | true | false |
invalid | data-invalid | true | false |
checked | data-checked | true | false |