Forms
Checkbox
Labelled checkbox row with description and indeterminate state, plus a bare CheckboxInput.
import { Checkbox, CheckboxInput } from "datui";Playground
<Checkbox>Remember me</Checkbox>Examples
Rows and indeterminate
Accessibility
- Radix Checkbox:
role="checkbox", Space toggles, indeterminate isaria-checked="mixed". - The whole row is a
<label>; the title names the box anddescriptionis linked witharia-describedby. readOnlykeeps the box focusable but ignores toggles.CheckboxInputneedsaria-label/aria-labelledby.
API
Checkbox
Labelled checkbox row. The whole row toggles; Space toggles from the keyboard.
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | |
| children | ReactNode | — | Label content. |
| className | string | — | |
| defaultChecked | boolean | — | |
| defaultIndeterminate | boolean | — | |
| description | ReactNode | — | Secondary text under the label, linked through `aria-describedby`. |
| indeterminate | boolean | — | Mixed state (shows a dash, `aria-checked="mixed"`); takes precedence over `checked`. |
| name | string | — | Form field name; a hidden native checkbox is submitted with the form. |
| noPadding | boolean | false | Remove row padding (inline use). |
| onCheckedChange | ((checked: CheckboxCheckedState) => void) | — | |
| readOnly | boolean | — | Focusable and announced, but clicks don't change the value. |
| required | boolean | — | |
| titleAfter | ReactNode | — | Content right after the label, e.g. a badge. |
| value | string | — |
CheckboxInput
Bare checkbox box (Radix Checkbox) for tables and custom layouts. Needs `aria-label` or `aria-labelledby`.
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | |
| className | string | — | |
| defaultChecked | boolean | — | |
| defaultIndeterminate | boolean | — | |
| indeterminate | boolean | — | Mixed state (shows a dash, `aria-checked="mixed"`); takes precedence over `checked`. |
| name | string | — | Form field name; a hidden native checkbox is submitted with the form. |
| onCheckedChange | ((checked: CheckboxCheckedState) => void) | — | |
| readOnly | boolean | — | Focusable and announced, but clicks don't change the value. |
| required | boolean | — | |
| value | string | — |