CraftUI

Checkbox

A green block checkbox with checked, unchecked, indeterminate and disabled states.

Installation

npx shadcn@latest add @runqora/craft-checkbox

Usage

import { Checkbox } from "@/components/craft/checkbox";

<Checkbox defaultChecked label="Show coordinates" />;

Examples

Indeterminate

Use indeterminate for a checkbox that stands for a group when only part of the group is on.

Props

Prop

Type

Accessibility

  • Space toggles the focused checkbox.
  • label is joined to the box, so clicking the text works too. Without a label, pass aria-label.
  • Indeterminate is announced as "mixed", and the state is also shown by the check or dash, so it never relies on color alone.

Customization

The box takes its checked color from the primary tokens.

<Checkbox
  className="[--craft-primary-hi:#5889ea] [--craft-primary-lo:#4a7fe8] [--craft-primary:#2e6be5]"
  label="Blue when checked"
/>

Dependencies

Source

On this page