Skip to Content
⭐️ Leave a star →
ComponentsCheckbox

Checkbox

Multi-select checkbox group. Controlled via value: (string | number)[] and onChange.

Features

Multi-select group with controlled state.
Full keyboard navigation.
Can be controlled or uncontrolled.
Supports disabled state per item or globally.

Example

You agree to our terms
You accept our privacy policy
Receive weekly updates
import { Checkbox } from '@wire-ui/react' <Checkbox.Root name="agreements"> <Checkbox.Item value="terms"> <Checkbox.Indicator> <svg viewBox="0 0 12 12" fill="none"> <path d="M2 6l3 3 5-5" stroke="currentColor" strokeWidth="2" /> </svg> </Checkbox.Indicator> <Checkbox.Label>Terms of Service</Checkbox.Label> </Checkbox.Item> </Checkbox.Root>

Styling

Checkbox items expose data-checked and data-disabled. Use them to style the checkbox indicator and label based on selection state.

<Checkbox.Item className=" group flex items-center gap-2 "> <span className=" border border-black bg-white group-data-[checked]:bg-black group-data-[checked]:text-white group-data-[disabled]:opacity-50 "> <Checkbox.Indicator>✓</Checkbox.Indicator> </span> <Checkbox.Label>Option</Checkbox.Label> </Checkbox.Item>

Using data attributes

Checkbox.Item sets data-checked when the item is selected and data-disabled when disabled.

/* Checked state */ [data-checked] .indicator { background: #000; color: #fff; } /* Disabled */ [data-disabled] { opacity: 0.5; cursor: not-allowed; }

Root props

PropTypeDefaultDescription
value(string | number)[]Controlled selected values
defaultValue(string | number)[][]Initial selected values
onChange(value: (string | number)[]) => voidCalled when selection changes
disabledbooleanfalseDisables all items

Item props

PropTypeDescription
valuestring | numberThe value this item represents
disabledbooleanDisables this specific item

Indicator data attributes

AttributeValues
data-state"checked" / "unchecked"
data-disabledPresent when disabled

Keyboard Interactions

KeyDescription
SpaceToggles the focused checkbox.
TabMoves focus to the next checkbox item.
Shift+TabMoves focus to the previous checkbox item.
Last updated on

MIT License © 2026 wire-ui

Checkbox – Wire UI