Checkbox
A control that allows the user to toggle between checked and not checked.
Features
- Supports indeterminate state.
- Full keyboard navigation.
- Can be controlled or uncontrolled.
Install the component from your command line.
Import the components and piece the parts together.
Create your styled checkbox component from the primitive parts.
Contains all the parts of a checkbox.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | button | |
defaultChecked | boolean | ||
checked | boolean | ||
onCheckedChange | function | ||
disabled | boolean | ||
required | boolean | ||
readOnly | boolean | ||
name | string | ||
value | string | on |
Renders when the checkbox is in a checked or indeterminate state. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | span | |
forceMount | boolean |
Adheres to the tri-state Checkbox WAI-ARIA design pattern.
Key | Description |
---|---|
Space | Checks/unchecks the checkbox. |
Enter | Checks/unchecks the checkbox. |