---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Checkbox

A round box a person ticks to mark one thing done or chosen, for React and Tailwind CSS. Free, MIT.

Free. Its export: `Checkbox`.

## Try it

Tick tasks by their words or Space, tick "Select all" to tick or clear them all; disable the boxes or mark them invalid from the panel.

Nothing is saved. "Select all" shows mixed while only some tasks are ticked.

## When to use

- A round box a person ticks to mark one thing done or chosen.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Checkbox on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/meadow-checkbox
```

```text
Add the Goop Checkbox to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { Checkbox, type CheckboxTint } from '@/components/ui/goop/checkbox';

function SurveyTasks({ done, onDone }: { done: boolean; onDone: (next: boolean) => void }) {
  return (
    <label className="flex items-center gap-3 text-sm">
      <Checkbox variant="done" checked={done} onCheckedChange={onDone} />
      Send the site survey
    </label>
  );
}

function FieldCalendar({ tint = 'cyan' }: { tint?: CheckboxTint }) {
  return (
    <label className="flex items-center gap-2 text-sm">
      <Checkbox tint={tint} defaultChecked />
      Field visits
    </label>
  );
}
```

- Fits: overview, schedule (their recipes); settings, flow: field.
- height, width, corner, background, text, motion: add no class for these.

## API reference

### Options

- `onCheckedChange?: (checked: boolean) => void` — Called after `onChange` with the box's new state, as the theme's switch and toggles report theirs.
- `indeterminate?: boolean` — Mixed: the box stands for a group only some of which is checked; the caller clears it when that changes.
- `tint?: 'cyan' | 'green' | 'orange' | 'pink' | 'red'` — A filled box in this colour, for a row that wears its own: shown only checked or mixed, under a white check.
- `variant?: CheckboxVariant = 'default'` — The checked look: `default` fills the box; `done` is a done to-do, the accent mark alone, no outline.
- `checked?: boolean`
- `defaultChecked?: boolean`
- `onChange?: (event: ChangeEvent<HTMLInputElement>) => void`
- `value?: string`
- `name?: string`
- `required?: boolean`
- `disabled?: boolean`
- `form?: string`

- State: checked (checked / defaultChecked / onCheckedChange); drawn by data-state=checked, data-state=indeterminate
- Types: CheckboxVariant = NonNullable<VariantProps<typeof fillVariants>['variant']>

## Keyboard

- Space: toggle

## Accessibility

- The native element answers the keyboard.
- hover, focus-visible, focus-within: the browser's own (:hover, :focus-visible, :focus-within): write nothing
- checked: the attribute data-state=checked
- indeterminate: the attribute data-state=indeterminate
- disabled: the prop disabled
- invalid: the attribute aria-invalid

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Radio group](/themes/meadow/components/radio-group): A named group of options of which exactly one is chosen, each option a whole row a press anywhere on chooses.
- [Choice group](/themes/meadow/components/choice-group): A group of choices for a form, a row each, with its label, a description and one error for the whole group.
- [Switch](/themes/meadow/components/switch): An on/off control for a setting that takes effect at once.
- [Select](/themes/meadow/components/select): One option from a short closed list.
