CheckboxField
Checkbox paired with a label and optional description, wired together for
accessibility (generated id, htmlFor, and aria-describedby); forwards
checkbox state props to the underlying Checkbox.
Get an alert when this material is back in stock.
Usage
import { CheckboxField, CheckboxFieldProps } from "@desk/ui/components/checkbox-field";Best practices
Use
CheckboxFieldfor a single labelled checkbox — it generates theid/htmlFor/aria-describedbywiring you'd otherwise hand-roll around a bareCheckbox.Put helper text in
description(linked viaaria-describedby), not a separate sibling element the screen reader won't announce with the control.sizeaccepts only"xs"/"sm"; for a full selectable card useCheckboxCardGroup, and render oneCheckboxFieldper option for a set.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| indeterminate | boolean | undefined | When true, displays an indeterminate state (dash icon). This is syntactic sugar for checked="indeterminate". | |
| label | React.ReactNode | Clickable label rendered beside the checkbox. | |
| description | React.ReactNode | Optional helper text below the label; wired to the checkbox via | |
| size | "xs" | "sm" | "xs" | |
| checkboxClassName | string | ||
| labelClassName | string | ||
| descriptionClassName | string |
Also exports
- type
CheckboxFieldProps