Usage
To create a checkbox, import <Checkbox>
and set the checked
and onCheckedChange
props. Checkboxes can be true
, false
, or "indeterminate"
.
Label
An accessible label can be displayed alongside a checkbox by passing a label
.
Help text
Display informative, secondary text beneath a label by passing helpText
.
You agree to our Terms of Service and Privacy Policy.
Sizing
A smaller version of the checkbox may be used by passing size="sm"
.
You agree to our Terms of Service and Privacy Policy.
API Reference
Checkbox
Inherits properties from HTMLButtonElement
.
Prop | Type | Default |
---|---|---|
align | "left" "right" | "left" |
asChild | boolean | false |
checked | boolean "indeterminate" | |
defaultChecked | boolean "indeterminate" | |
disabled | boolean | |
helpText | string | |
label | string | |
name | string | |
onCheckedChange | (checked: boolean | "indeterminate") => void | |
required | boolean | |
size | "default" "sm" | "default" |
value | string |