---
title: "Checkbox"
description: "Form choice control with a draw-on checkmark, spring press feedback and indeterminate state support."
category: "Components"
publishedAt: "2026-06-23"
updatedAt: "2026-11-10"
documentation: "https://beui.dev/components/motion/checkbox"
markdown: "https://beui.dev/components/motion/checkbox.md"
license: "MIT"
---

# Checkbox

> Form choice control with a draw-on checkmark, spring press feedback and indeterminate state support.

## Install

```bash
npx shadcn@latest add @beui/checkbox
```

## Dependencies

- `clsx`
- `motion`
- `react`
- `tailwind-merge`

## Usage

### Checkbox usage

Draw-on checkmark, spring press feedback and indeterminate state.

```tsx
"use client";

import { useState } from "react";
import { Checkbox } from "@/components/motion/checkbox";

export function CheckboxPreview() {
  const [terms, setTerms] = useState(true);
  const [updates, setUpdates] = useState(false);

  return (
    <div className="flex flex-col gap-3">
      <Checkbox
        checked={terms}
        onCheckedChange={setTerms}
        label="Accept terms and conditions"
      />
      <Checkbox
        checked={updates}
        onCheckedChange={setUpdates}
        label="Email me product updates"
      />
      <Checkbox checked indeterminate onCheckedChange={() => {}} label="Select all (partial)" />
      <Checkbox checked disabled onCheckedChange={() => {}} label="Disabled" />
    </div>
  );
}
```

### With Description usage

Optional supporting text under each label, exposed to assistive technology as the description.

```tsx
"use client";

import { useState } from "react";
import { Checkbox } from "@/components/motion/checkbox";

export function CheckboxDescriptionPreview() {
  const [comments, setComments] = useState(true);
  const [mentions, setMentions] = useState(true);
  const [digest, setDigest] = useState(false);

  return (
    <div className="flex w-full max-w-64 flex-col gap-3">
      <Checkbox
        checked={comments}
        onCheckedChange={setComments}
        label="Comments"
        description="Replies on threads you started."
      />
      <Checkbox
        checked={mentions}
        onCheckedChange={setMentions}
        label="Mentions"
        description="Whenever someone tags you by name."
      />
      <Checkbox
        checked={digest}
        onCheckedChange={setDigest}
        label="Weekly digest"
        description="A summary of activity every Monday."
      />
      <Checkbox
        checked={false}
        disabled
        onCheckedChange={() => {}}
        label="SMS alerts"
        description="Add a phone number to enable."
      />
    </div>
  );
}
```

## API Reference

### Checkbox

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `checked` | `boolean` |  | Yes | Whether the box is checked. |
| `onCheckedChange` | `(checked: boolean) => void` |  | Yes | Called with the new state when the box is toggled. |
| `disabled` | `boolean` |  | No | Blocks toggling and dims the control. |
| `indeterminate` | `boolean` |  | No | Shows a dash for a partly selected group. Announced as mixed. |
| `label` | `string` |  | No | Visible text beside the box, also its accessible name. |
| `description` | `string` |  | No | Supporting text under the label, announced as the description rather than the name. |
| `className` | `string` |  | No | Classes merged onto the root label element. |
| `id` | `string` |  | No | Id for the checkbox button. Generated when omitted. |
| `aria-label` | `string` |  | No | Accessible name when there is no visible label. |
| `aria-describedby` | `string` |  | No | Associates an external message (e.g. a form error) with the control. |
| `labels` | `Partial<{ checked: string; indeterminate: string; }>` |  | No | Override any built-in string. |

## About Checkbox

Checkbox is an animated checkbox for React built with Framer Motion and Tailwind CSS. The check mark draws itself on when selected, the box presses in with a spring, and an indeterminate state draws a dash for partially selected groups. It takes an optional label and a description line underneath.

### When to use it

- A sign-up or checkout form needs a terms, newsletter or remember-me checkbox.
- A table or list needs a select-all control that shows a partial state when only some rows are checked.
- A settings page lists independent options, each with a short description under its label.

### Accessibility

The checkbox is a button with the checkbox role and aria-checked, which reports mixed for the indeterminate state, and Space or Enter toggles it. The label names the control, the description is announced as its description rather than part of the name, and aria-describedby can link an external message such as a form error. With reduced motion enabled, the mark appears without drawing or scaling and the press effect is removed.

### FAQ

**How do I make an animated checkbox in React?**

Install the component and render Checkbox with checked and onCheckedChange. It is controlled, so keep the checked state in your component and pass label for the visible text.

**How do I show an indeterminate checkbox?**

Set the indeterminate prop. The box shows a dash and screen readers hear it as partially checked, which suits a select-all control when only some items are selected.

**How do I connect an error message to the checkbox?**

Give the message an id and pass it through aria-describedby. Use the description prop for helper text under the label, which is linked the same way.

## React Native

A React Native version ships in beUI Native. The detail JSON has every file to copy.

```bash
npx expo install react-native-reanimated react-native-worklets
npm install uniwind tailwindcss
```

- Native detail: https://beui.dev/native/r/checkbox
- GitHub: https://github.com/starc007/beui-native/tree/main/src/components/checkbox

## Source

- Registry detail: https://beui.dev/r/checkbox
- Raw source: https://beui.dev/r/checkbox/raw
- GitHub: https://github.com/starc007/ui-components
