Checkbox
An easily stylable checkbox component.
API reference
Import the component and assemble its parts:
import { Checkbox } from '@base-ui-components/react/checkbox';
<Checkbox.Root>
  <Checkbox.Indicator />
</Checkbox.Root>Root
Represents the checkbox itself.
Renders a <button> element and a hidden <input> beside.
| Prop | Type | Default | |
|---|---|---|---|
name | 
  | 
  | |
defaultChecked | 
  | 
  | |
checked | 
  | 
  | |
onCheckedChange | 
  | 
  | |
indeterminate | 
  | 
  | |
value | 
  | 
  | |
parent | 
  | 
  | |
disabled | 
  | 
  | |
readOnly | 
  | 
  | |
required | 
  | 
  | |
inputRef | 
  | 
  | |
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-checked | Present when the checkbox is checked.  | |
data-unchecked | Present when the checkbox is not checked.  | |
data-disabled | Present when the checkbox is disabled.  | |
data-readonly | Present when the checkbox is readonly.  | |
data-required | Present when the checkbox is required.  | |
data-valid | Present when the checkbox is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the checkbox is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the checkbox's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the checkbox has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the checkbox is checked (when wrapped in Field.Root).  | |
data-focused | Present when the checkbox is focused (when wrapped in Field.Root).  | |
Indicator
Indicates whether the checkbox is ticked.
Renders a <span> element.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
keepMounted | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-checked | Present when the checkbox is checked.  | |
data-unchecked | Present when the checkbox is not checked.  | |
data-disabled | Present when the checkbox is disabled.  | |
data-readonly | Present when the checkbox is readonly.  | |
data-required | Present when the checkbox is required.  | |
data-valid | Present when the checkbox is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the checkbox is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the checkbox's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the checkbox has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the checkbox is checked (when wrapped in Field.Root).  | |
data-focused | Present when the checkbox is focused (when wrapped in Field.Root).  | |
data-starting-style | Present when the checkbox indicator is animating in.  | |
data-ending-style | Present when the checkbox indicator is animating out.  | |