Checkbox

Checkboxes select zero or more options in a visible group and support checked, unchecked, indeterminate, invalid, disabled, and read-only states.

Overview and decision boundary

Use Checkbox for grouped multi-selection and aggregate indeterminate state; use Switch for standalone boolean values.

Do not use Checkbox for mutually exclusive options or immediate on/off settings; use RadioGroup or Switch instead.

Visible collections
Include archived collectionsArchived collections remain visible in search results.Some collections are archivedThis selection represents a partial set of archived collections.Archived collections are unavailable
import { FormGroup } from "@nerio-ui/ui";import { Checkbox } from "@nerio-ui/ui/client";<FormGroup title="Visible collections">  <Checkbox defaultChecked label="Active collections" />  <Checkbox label="Archived collections" /></FormGroup>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add checkboximport { Checkbox } from '@nerio-ui/ui/client';

Usage

import { Checkbox } from '@nerio-ui/ui/client';<Checkbox  defaultChecked  name="includeArchived"  label="Include archived collections"  description="Archived collections remain visible in search results."/>// Use indeterminate for an aggregate or partial selection.<Checkbox aria-label="Partially selected" indeterminate />

Variants

VariantUse
DefaultOne option in a visible multi-selection group.

Anatomy

SlotPurpose
fieldOptional wrapper that groups a Checkbox with its label and description.
rootBase UI checkbox control with checked, indeterminate, disabled, and read-only state.
indicatorNerio icon adapter Check or Minus indicator.
labelOptional visible name connected to the control with aria-labelledby.
descriptionOptional supporting text connected with aria-describedby.

States

StateBehavior
UncheckedOption is available but not selected.
CheckedOption is selected.
IndeterminateRepresents an aggregate or partial selection.
InvalidExplicit invalid state maps to aria-invalid.
DisabledOption is unavailable.
Read-onlyOption remains visible but does not accept changes.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Uses the Base UI Checkbox primitive for keyboard and checked-state behavior.
  • Use Checkbox only for grouped multi-selection; use Switch for standalone boolean values and RadioGroup for mutually exclusive choices.
  • Provide a visible label or accessible name with aria-label or aria-labelledby; label automatically connects the visible name.
  • Description automatically connects supporting text with aria-describedby, while explicit aria-describedby values are preserved.
  • Supports checked, defaultChecked, onCheckedChange, disabled, required, name, value, form, id, and aria-describedby through the Base UI root props.
  • Invalid state is explicit through invalid or aria-invalid and does not announce errors automatically.
  • Disabled state prevents interaction and reduces emphasis.
  • The Check and Minus indicators render through the Nerio icon adapter, including aria-checked=mixed for indeterminate state.

API

PropPurpose
checked / defaultChecked / onCheckedChangeControlled and uncontrolled checked-state APIs from the Base UI root.
labelOptional visible name for a checkbox field row.
descriptionOptional supporting text displayed below label and announced as a description.
name / value / form / required / disabled / readOnlyNative form metadata is preserved through the Base UI root props.
invalidSets data-invalid and aria-invalid when true.
classNameExtends the checkbox control, not the optional field wrapper.

Implementation contract

ContractValue
Registry itemcheckbox installs 7 Tailwind-first source files into the configured components directory.
Base UIcheckbox
Registry dependenciesNone.
Package dependencies@base-ui/react, @nerio-ui/adapters, clsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use Checkbox for grouped multi-selection and aggregate indeterminate state; use Switch for standalone boolean values.

Do / do not

Do

Use Checkbox for grouped multi-selection such as filters, permissions, or visible option lists.

Do not

Use Checkbox for a standalone yes/no value or mutually exclusive options; use Switch or RadioGroup instead.

Tokens

GroupTokensControls
Sizing--n-checkbox-sizeControl size across density modes.
Shape--n-checkbox-radiusFour-pixel corner radius for familiar checkbox geometry.
Selected--n-color-action-primary / --n-color-action-on-primarySelected surface and icon.
Invalid--n-input-border-dangerInvalid border treatment.
Focus--n-focus-ringVisible keyboard focus treatment.