Skip to content
FelicityUI

Checkbox

A control that allows the user to toggle between checked and not checked.

Installation

terminal
npx felicityui add checkbox --platform react

Usage

example.tsx
import { Checkbox } from "@/components/ui/checkbox"

<Checkbox />

Composition

Checkbox
└── (optional) label / description / error

Default

Checked state

Controlled with checked + onCheckedChange.

Invalid

aria-invalid and data-invalid on the field shell.

Basic

Pair with a label for layout.

Description

Helper text under the label.

Includes failed jobs and preview artifacts.

Disabled

disabled sets data-disabled on the field shell.

Group

Multiple fields as a checkbox list.

Notifications

Table

Row selection with indeterminate select-all.

ServiceStatus
api-gatewayHealthy
workerDeploying
webHealthy

RTL

dir=rtl

يشمل الوظائف الفاشلة.

API Reference

PropTypeDefaultDescription
checkedboolean—Controlled checked state.
defaultCheckedboolean—Uncontrolled initial checked state.
onCheckedChange(checked: boolean) => void—Called when checked state changes.
indeterminateboolean—Shows the indeterminate visual state.
labelReactNode—Optional field label.
descriptionReactNode—Helper text below the label.
errorReactNode—Error message; sets invalid styling.
invalidboolean—Marks invalid without requiring error text.
disabledboolean—Disables the checkbox.
classNamestring—Additional classes on the input hit target.
checkboxVariants({ invalid?, className? }) => string—Exported class helper for the indicator.

Accessibility

WCAG 2.2 AA

  • Native checkbox semantics and keyboard support.
  • Label associated via htmlFor when field chrome is used.
  • aria-invalid and role=alert for errors.
  • Visible focus-visible ring on the indicator.

Platform notes

React

Native HTML checkbox with Felicity semantic tokens. Copper fill when checked — not Base UI / Radix runtime.

  • Client component (indeterminate + onCheckedChange).
  • Uses data-slot=checkbox|checkbox-indicator; field chrome uses data-slot=field|field-label|field-description|field-error.
  • data-invalid and data-disabled on the field shell when chrome is present.
  • Supports controlled checked + onCheckedChange and indeterminate.