Web · Components
Checkbox
Checkbox.
2 exports
Live example
Preview
Code
Events
- Events appear here when you interact with the preview.
Import
Checkbox. Built on a real <input type="checkbox">, so it works with forms, FormData, the keyboard and screen readers even before JavaScript loads. Can be used controlled (checked) or uncontrolled (defaultChecked).
On touch screens the touch area is extended to 44×44 px without changing the look.
Examples
CheckboxProps
interfaceProps of the Checkbox component.
Extends: Omit<ComponentProps<"input">, "type">
| Name | Type | Description |
|---|---|---|
indeterminate? | boolean | Indeterminate (neither checked nor unchecked) look. Used for "Select all" while only some children are selected. |
onCheckedChange? | (checked: boolean) => void | Called with the new value when the check state changes. A shortcut for onChange. |
label? | ReactNode | Label next to the box; all of it is clickable. When given, className is applied to the label itself. |
description? | ReactNode | Description below the label; screen readers read it with the box. |
tooltip? | TooltipProp | Tooltip shown on hover, keyboard focus or long press on touch screens. It opens from the whole label and screen readers read it with the box. See TooltipProp. |
effect? | EffectProp | Effect or effects of the box (e.g. "pulse", "bounce"). Defaults to UIProvider appearance.defaults.checkbox.effect. See BuiltinEffect. |