adn-ui
Components

Checkbox

A high-quality, styled React checkbox component built with @base-ui/react that is easy to customize.

The Checkbox component allows users to toggle between checked and unchecked boolean states.

Usage

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

export function ExampleCheckbox() {
  return (
    <label className="flex items-center gap-2 text-sm font-medium">
      <Checkbox.Root defaultChecked>
        <Checkbox.Indicator />
      </Checkbox.Root>
      Enable notifications
    </label>
  );
}

Preview

Sizes

<Checkbox.Root size="sm">...</Checkbox.Root>
<Checkbox.Root size="md">...</Checkbox.Root>
<Checkbox.Root size="lg">...</Checkbox.Root>

Anatomy

import { Checkbox } from "@base-ui/react/checkbox";

<Checkbox.Root>
  <Checkbox.Indicator />
</Checkbox.Root>;

API Reference

Checkbox.Root Props

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Checkbox dimensions.
checkedbooleanundefinedControlled checked state.
defaultCheckedbooleanfalseUncontrolled initial checked state.
onCheckedChange(checked: boolean) => voidundefinedCallback fired on checked state change.
disabledbooleanfalseDisables user interaction.
indeterminatebooleanfalseMixed state (neither checked nor unchecked).

On this page