---
title: Checkbox
description: A control that allows the user to toggle between checked and not checked.
base: aria
component: true
links:
doc: https://react-aria.adobe.com/Checkbox
api: https://react-aria.adobe.com/Checkbox#api
---
## Installation
Command
Manual
```bash
npx shadcn@latest add checkbox
```
Install the following dependencies:
```bash
npm install react-aria-components
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage
```tsx
import { Checkbox } from "@/components/ui/checkbox"
```
```tsx
```
## Checked State
Use `defaultSelected` for uncontrolled checkboxes, or `isSelected` and
`onChange` to control the state.
```tsx showLineNumbers
import * as React from "react"
export function Example() {
const [checked, setChecked] = React.useState(false)
return
}
```
## Invalid State
Set `isInvalid` on the checkbox and `data-invalid` on the field wrapper to
show the invalid styles.
## Basic
Pair the checkbox with `Field` and `FieldLabel` for proper layout and labeling.
## Description
Use `FieldContent` and `FieldDescription` for helper text.
## Disabled
Use the `isDisabled` prop to prevent interaction and add the `data-disabled` attribute to the `` component for disabled styles.
## Group
Use multiple fields to create a checkbox list.
## Table
## RTL
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference
See the [React Aria](https://react-aria.adobe.com/Checkbox#api) documentation for more information.