Checkbox

An easily stylable checkbox component.

API reference

Import the component and assemble its parts:

Anatomy
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.

PropTypeDefault
name

string

undefined

defaultChecked

boolean

false

checked

boolean

undefined

onCheckedChange

(checked, event) => void

undefined

indeterminate

boolean

false

value

number | string

undefined

parent

boolean

false

disabled

boolean

false

readOnly

boolean

false

required

boolean

false

inputRef

React.Ref

undefined

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-checked
data-unchecked
data-disabled
data-readonly
data-required
data-valid
data-invalid
data-dirty
data-touched

Indicator

Indicates whether the checkbox is ticked. Renders a <span> element.

PropTypeDefault
className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-checked
data-unchecked
data-disabled
data-readonly
data-required
data-valid
data-invalid
data-dirty
data-touched
data-starting-style
data-ending-style