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@latest add checkbox

Usage

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

<Checkbox id="terms" />

API

Prop Type Default
checked / defaultChecked boolean | "indeterminate" — controlled/uncontrolled state
onCheckedChange (checked: boolean | "indeterminate") => void
disabled boolean false
required boolean false
name / value string — form field name and submitted value

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.