Checkbox

Toggles a single option on or off.

@paneui/theme@paneui/control-size@base-ui/reactclass-variance-authority

Installation

pnpm dlx shadcn@latest add @paneui/checkbox

Usage

Examples

With Description

Controlled

Disabled

Task List

Sizes

Motion

Presses squish to 86% on an overshoot curve. With reduced motion the transitions and the squish are off.

Keyboard

Tab to focus and Space to toggle.

API Reference

Built on the Checkbox primitive. Only the props this library adds or changes are listed; everything else passes through.

Checkbox

An 18px box in an inset well. It adds no props of its own. Also accepts every prop of Checkbox.Root.

size= "default"
"sm" | "default" | "lg"
Box 14 / 16 / 20px. Inside a sized Field it takes the field's size (xs maps to sm).
checked
boolean
Controlled checked state.
defaultChecked= false
boolean
Checked state on first render.
onCheckedChange
(checked: boolean, details) => void
Called when the box is toggled.
indeterminate= false
boolean
Shows a dash instead of the check, e.g. for a partly selected parent.
disabled= false
boolean
Dims the box and blocks interaction.
PropTypeDefaultDescription
size"sm" | "default" | "lg""default"Box 14 / 16 / 20px. Inside a sized Field it takes the field's size (xs maps to sm).
checkedboolean—Controlled checked state.
defaultCheckedbooleanfalseChecked state on first render.
onCheckedChange(checked: boolean, details) => void—Called when the box is toggled.
indeterminatebooleanfalseShows a dash instead of the check, e.g. for a partly selected parent.
disabledbooleanfalseDims the box and blocks interaction.
data-size
The resolved size.
data-checked
Present when checked (primary fill).
data-indeterminate
Present when indeterminate.
data-disabled
Present when disabled.
data-invalid
Present when invalid inside a Field (destructive ring).
Data attributeDescription
data-sizeThe resolved size.
data-checkedPresent when checked (primary fill).
data-indeterminatePresent when indeterminate.
data-disabledPresent when disabled.
data-invalidPresent when invalid inside a Field (destructive ring).