# Checkbox

Ticks with a little jelly wobble and a stamped check mark.

Docs: https://cozy-ui.solo.engineer/docs/components/checkbox/

Install: `npx shadcn@latest add @cozy/checkbox`

### Usage

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

<Checkbox defaultChecked />
```

### Example

```tsx
import { Checkbox } from "@/components/ui/checkbox";
import { Label } from "@/components/ui/label";

export default function CheckboxDemo() {
  return (
    <div className="grid gap-3">
      <Label className="cursor-pointer"><Checkbox defaultChecked /> Water the seedlings</Label>
      <Label className="cursor-pointer"><Checkbox /> Let neighbours help with watering</Label>
      <Label><Checkbox disabled /> Unlocks at level 5</Label>
    </div>
  );
}
```

### Source (components/ui/checkbox.tsx)

```tsx
import * as React from "react";
import { Checkbox as CheckboxPrimitive } from "radix-ui";
import { cn } from "@/lib/utils";
import { CheckGlyph } from "./glyphs";

function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
  return (
    <CheckboxPrimitive.Root data-slot="checkbox" className={cn("cz-checkbox", className)} {...props}>
      <CheckboxPrimitive.Indicator data-slot="checkbox-indicator">
        <CheckGlyph />
      </CheckboxPrimitive.Indicator>
    </CheckboxPrimitive.Root>
  );
}

export { Checkbox };
```

npm: `import { Checkbox } from "@0xtrou/cozy-ui"` (after `npm install @0xtrou/cozy-ui` and `import "@0xtrou/cozy-ui/styles.css"`).
