Skip to main content
A checkbox component that allows users to select one or more options.

Import

Anatomy

The Checkbox component consists of two parts:
  • Checkbox.Root - The checkbox control itself
  • Checkbox.Indicator - Visual indicator for the checked state

Basic Usage

Key Features

  • Controlled and uncontrolled modes
  • Indeterminate state support
  • Accessible with proper ARIA attributes
  • Works seamlessly with Field and Form components
  • Support for parent-child checkbox relationships
  • Custom render props

Key Props

checked

Type: boolean Default: undefined Whether the checkbox is currently ticked. Use with onCheckedChange for controlled mode.

defaultChecked

Type: boolean Default: false Whether the checkbox is initially ticked. Use for uncontrolled mode.

onCheckedChange

Type: (checked: boolean, eventDetails: ChangeEventDetails) => void Event handler called when the checkbox is ticked or unticked.

disabled

Type: boolean Default: false Whether the component should ignore user interaction.

readOnly

Type: boolean Default: false Whether the user should be unable to tick or untick the checkbox.

required

Type: boolean Default: false Whether the user must tick the checkbox before submitting a form.

indeterminate

Type: boolean Default: false Whether the checkbox is in a mixed state: neither ticked, nor unticked.

name

Type: string Identifies the field when a form is submitted.

value

Type: string The value of the selected checkbox.

Styling

Common Patterns

With Label

Indeterminate State