Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Checkbox

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

Installation

npx logic2b@next add checkbox

Usage

import { Checkbox } from "@/components/ui/checkbox"

<Checkbox id="terms" />

Examples

With text

Pair the checkbox with a Label and helper description.

You can turn these off at any time in settings.

Disabled

Accessibility

  • Renders a native-equivalent control with role="checkbox" and reflects state via aria-checked (including the mixed/indeterminate state).
  • Space toggles the focused checkbox; it is reachable and focusable with Tab.
  • Associate a Label via htmlFor matching the checkbox id so clicking the text toggles it.

Live playground

Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.

Generated JSX
<Checkbox
  defaultChecked
  aria-label="Accept terms"
 />

API reference

Generated from the public TypeScript exports in src/ui/checkbox.tsx.

View JSON

Checkbox

Component
Props: React.ComponentProps<typeof CheckboxPrimitive.Root>

Accessibility contract

Machine-readable behavior and consumer responsibilities for checkbox.

View JSON
Support
Primitive-managed
Pattern
checkbox
Radix Checkbox
Keyboard interactions for checkbox
KeysBehavior
Enter SpaceActivate the focused control.

Built-in semantics

  • Exposes role=checkbox and aria-checked, including the mixed state.

Consumer responsibilities

  • Associate the control with a visible Label or aria-label.