Skip to content
Forms

Checkbox

Binary choice with an indicator.

Import

tsx
import { Checkbox } from "@cronus-ui/ui";
bash
npx cronus-ui add checkbox

Examples

.cronus

The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.

PortedParity: MatchGeometry 2/2Pixel diff 0 pxLogic 1/1Parity scoreboard
off.cronus
app "audit-fixtures" {
  port 5176
}

style {
  preset aurora
  theme dark
}

component CheckboxOff layout:inline style:checkbox {
  aria-label:"Accept"
  label "Accept"
}

page "/audit/checkbox/off" type:custom {
  use CheckboxOff
}
on.cronus
app "audit-fixtures" {
  port 5176
}

style {
  preset aurora
  theme dark
}

component CheckboxOn layout:inline style:checkbox {
  checked:true
  aria-label:"Accept"
  label "Accept"
}

page "/audit/checkbox/on" type:custom {
  use CheckboxOn
}

API Reference

Generated from the component's exported types.

CheckboxProps

Extends ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>

Skip CheckboxProps props table
PropTypeDefaultDescription
checked
boolean—Controlled checked state. Pair with `onCheckedChange`.
defaultChecked
boolean—Uncontrolled initial checked state.
onCheckedChange
(checked: boolean) => void—Called with the next checked value whenever the control toggles.
disabled
boolean—Disables pointer and keyboard interaction.
required
boolean—Marks the control as required.
name
string—Submitted name when used in a form.
value
string—Controlled value.
asChild
boolean—Render as the child element via Slot.