datui
Color scheme

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 is aria-checked="mixed".
  • The whole row is a <label>; the title names the box and description is linked with aria-describedby.
  • readOnly keeps the box focusable but ignores toggles. CheckboxInput needs aria-label/aria-labelledby.

API

Checkbox

Labelled checkbox row. The whole row toggles; Space toggles from the keyboard.

PropTypeDefaultDescription
checkedboolean—
childrenReactNode—Label content.
classNamestring—
defaultCheckedboolean—
defaultIndeterminateboolean—
descriptionReactNode—Secondary text under the label, linked through `aria-describedby`.
indeterminateboolean—Mixed state (shows a dash, `aria-checked="mixed"`); takes precedence over `checked`.
namestring—Form field name; a hidden native checkbox is submitted with the form.
noPaddingbooleanfalseRemove row padding (inline use).
onCheckedChange((checked: CheckboxCheckedState) => void)—
readOnlyboolean—Focusable and announced, but clicks don't change the value.
requiredboolean—
titleAfterReactNode—Content right after the label, e.g. a badge.
valuestring—

CheckboxInput

Bare checkbox box (Radix Checkbox) for tables and custom layouts. Needs `aria-label` or `aria-labelledby`.

PropTypeDefaultDescription
checkedboolean—
classNamestring—
defaultCheckedboolean—
defaultIndeterminateboolean—
indeterminateboolean—Mixed state (shows a dash, `aria-checked="mixed"`); takes precedence over `checked`.
namestring—Form field name; a hidden native checkbox is submitted with the form.
onCheckedChange((checked: CheckboxCheckedState) => void)—
readOnlyboolean—Focusable and announced, but clicks don't change the value.
requiredboolean—
valuestring—