Checkbox

A checkbox component with convenience and compound APIs

A checkbox component built with Ark UI that supports both a convenience API and a full compound API.

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

export default function Example() {
  return <Checkbox label="I accept the terms and conditions" />;
}

Installation

bash
liminal add checkbox

Usage

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

export default function Example() {
  return <Checkbox label="I accept the terms and conditions" />;
}

Examples

Compound API

import {
  CheckboxRoot,
  CheckboxControl,
  CheckboxLabel,
  CheckboxHiddenInput,
} from "@/components/ui/checkbox";

export default function Example() {
  return (
    <CheckboxRoot className="inline-flex items-center gap-2">
      <CheckboxHiddenInput />
      <CheckboxControl />
      <CheckboxLabel>Subscribe to newsletter</CheckboxLabel>
    </CheckboxRoot>
  );
}

API

PropTypeDefaultDescription
labelReact.ReactNode-Label text shown next to the checkbox.
checkedboolean-Controlled checked state.
defaultCheckedboolean-Initial checked state when uncontrolled.
onCheckedChange(details: { checked: boolean }) => void-Callback when checked state changes.