Checkbox allows a user to select individual items from a list.
The checkbox's disabled state.
When table rows can be selected, it's a good practice to place a parent checkbox on top of the table rows, which selects or deselects all rows at once.
Indeterminate state is used when there are some table rows selected, but not all of them. Checked state doesn't apply in that case, because there are rows which aren't selected. Same for unchecked state, because there are rows that are selected. So indeterminate state is like a middle ground between checked and unchecked states.
Initial
Checked
Indeterminate
Default
Hovered
Focused
Disabled
Invalid
Inherits margin props.
| Name | Default | Description |
|---|---|---|
aria-label | "Select checkbox" | stringCheckbox's meaning for screen readers. Required when `label` is not provided. |
isChecked | — | booleanDetermines if checkbox is checked. |
id | — | stringCheckbox's id. |
isDisabled | — | booleanWhen `true`, user is not allowed to interact with the checkbox. |
isIndeterminate | — | booleanIndeterminate checkbox indicates that some items were selected, but not all. |
label | — | stringLabel to show near the checkbox. |
badge | — | ReactNodeBadge to display near the label. |
description | — | ReactNodeDescription to show below the label. |
onChange | — | (checked: ChangeEvent<HTMLInputElement>) => voidCallback for when user toggles the checkbox. |