Checkbox

Checked, unchecked, and indeterminate, alone or in a group.

Base UI CheckboxBase UI Checkbox GroupSource

States

A checkbox is unchecked, checked, or indeterminate. Checkbox.Indicator draws a check mark or a dash.

Controlled

Pass checked and onCheckedChange to keep the state in your component.

Disabled

A disabled box has 50% opacity. Add text-muted to the label yourself.

Checkbox group

CheckboxGroup keeps the values of the checked boxes in one array. The parent checkbox checks or clears all items.

Usage

These are defaults, not laws. Break one when you have a good reason, or when it makes the design more cohesive or more interesting.

  • Choose the input from the number of options and what the user picks.
    ComponentUse it for
    RadioOne choice from 2 or 3 options that stay visible.
    SelectOne choice from 4 to about 10 options, or fewer options when space is tight.
    ComboboxOne or more choices from a long list, with typing to filter.
    AutocompleteFree text, with suggestions that the user can ignore.
    ChoiceboxA choice where each option needs a description, such as a plan.
    CheckboxAn on or off value in a form that the user submits.
    SwitchA setting that applies at once.
  • Put Checkbox.Root and its text in a <label>, so a click on the text toggles it.
  • For select all, pass allValues to CheckboxGroup and add a Checkbox.Root with parent.

API

Props that the library adds. Every part also takes all the Base UI props.

Checkbox.Indicator

PropTypeDefaultDescription
keepMountedbooleantrueKeeps the indicator in the DOM when the box is unchecked. The Base UI default is false.
childrenReactNodeA check mark and a dashThe glyphs in the box. Pass children to replace them.