# Checkbox

Checkbox with indeterminate state



<ComponentPreview base="ink" name="checkbox-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/checkbox
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="ink" name="checkbox" title="components/ui/checkbox.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

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

```tsx
<Checkbox checked label="Enable telemetry" onChange={(checked) => {}} />
```

API Reference [#api-reference]

Checkbox [#checkbox]

| Prop                | Type                         | Default |
| ------------------- | ---------------------------- | ------- |
| `checked`           | `boolean`                    | -       |
| `onChange`          | `(checked: boolean) => void` | -       |
| `label`             | `string`                     | -       |
| `indeterminate`     | `boolean`                    | `false` |
| `disabled`          | `boolean`                    | `false` |
| `id`                | `string`                     | -       |
| `checkedIcon`       | `string`                     | `"■"`   |
| `uncheckedIcon`     | `string`                     | `"□"`   |
| `indeterminateIcon` | `string`                     | `"▪"`   |
