---
title: Toggle Group
description: A set of two-state buttons that can be toggled on or off.
component: true
links:
doc: https://www.radix-ui.com/docs/primitives/components/toggle-group
api: https://www.radix-ui.com/docs/primitives/components/toggle-group#api-reference
---
## Installation
CLI
Manual
```bash
npx shadcn@latest add toggle-group
```
Install the following dependencies:
```bash
npm install @radix-ui/react-toggle-group
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage
```tsx
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
```
```tsx
A
B
C
```
## Examples
### Outline
### Single
### Small
### Large
### Disabled
### Spacing
Use `spacing={2}` to add spacing between toggle group items.
## API Reference
### ToggleGroup
The main component that wraps toggle group items.
| Prop | Type | Default |
| ----------- | --------------------------- | ----------- |
| `type` | `"single" \| "multiple"` | `"single"` |
| `variant` | `"default" \| "outline"` | `"default"` |
| `size` | `"default" \| "sm" \| "lg"` | `"default"` |
| `spacing` | `number` | `0` |
| `className` | `string` | |
```tsx
A
B
```
### ToggleGroupItem
Individual toggle items within a toggle group. Remember to add an `aria-label` to each item for accessibility.
| Prop | Type | Default |
| ----------- | -------- | -------- |
| `value` | `string` | Required |
| `className` | `string` | |