Unified UI

Checkbox

An accessible checkbox component with label, description, indeterminate state, and group support.

Overview

The Checkbox component is an accessible checkbox built on Radix UI. It supports labels, descriptions, indeterminate state, error styling, two sizes, and group composition with vertical or horizontal orientation.


Installation

Install the component via the CLI in one command.

npx @work-rjkashyap/unified-ui add checkbox
pnpm dlx @work-rjkashyap/unified-ui add checkbox
npx @work-rjkashyap/unified-ui add checkbox
bunx @work-rjkashyap/unified-ui add checkbox

If you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.

Or install the full package

Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.

npm install @work-rjkashyap/unified-ui
pnpm add @work-rjkashyap/unified-ui
yarn add @work-rjkashyap/unified-ui
bun add @work-rjkashyap/unified-ui

Anatomy

import {
	Checkbox,
	CheckboxGroup,
} from "@work-rjkashyap/unified-ui";

Examples

Basic Usage

Sizes

With Description

Indeterminate State

Disabled State

Error State

You must accept the terms to continue.

Checkbox Group — Vertical

Notifications

Checkbox Group — Horizontal

Interests

Checkbox Group — With Description

Privacy settings

Combined Features

Account preferences
Required to create an account.

Props

Checkbox

PropTypeDefaultDescription
checkedboolean | "indeterminate"Controlled checked state.
defaultCheckedbooleanfalseInitial checked state (uncontrolled).
onCheckedChange(checked: boolean | "indeterminate") => voidCallback when checked state changes.
size"sm" | "md""md"Size of the checkbox.
labelReactNodeClickable label text.
descriptionReactNodeDescription text below the label.
valuestringValue used when inside a CheckboxGroup.
errorbooleanfalseWhether to show error styling.
disabledbooleanfalseWhether the checkbox is disabled.
classNamestringAdditional CSS classes.

CheckboxGroup

PropTypeDefaultDescription
labelReactNodeGroup label displayed above the checkboxes.
descriptionReactNodeDescription text below the group label.
orientation"vertical" | "horizontal""vertical"Layout direction of the checkboxes.
size"sm" | "md""md"Size applied to all child checkboxes.
errorbooleanfalseWhether to show error styling on all children.
disabledbooleanfalseWhether all children are disabled.
classNamestringAdditional CSS classes.

Accessibility

Built on @radix-ui/react-checkbox which provides full keyboard and screen reader support out of the box.

  • KeyboardSpace toggles the checkbox. Tab moves focus between checkboxes.
  • Focus ring — Visible on keyboard navigation via focus-visible.
  • Label — Clicking the label text toggles the checkbox (integrated <label> element).
  • Indeterminate — Properly exposed via aria-checked="mixed".
  • GroupCheckboxGroup uses role="group" with aria-labelledby for the group label.
  • Disabled — Sets both the disabled attribute and aria-disabled.
  • Error — The error prop applies visual styling. Pair with aria-describedby and an error message element for screen reader support.

Design Tokens

TokenUsage
--primaryChecked state background
--primary-foregroundCheckmark icon color
--dangerError state border
--radius-smCheckbox border radius
--duration-fastTransition speed

On this page