---
title: Toggle Group
description: Provides a shared state to a series of toggle buttons.
author:
  name: imskyleen
  url: https://github.com/imskyleen
---

<ComponentPreview name="base-toggle-group-demo" />

## Installation

<ComponentInstallation name="base-toggle-group" />

## Usage

```tsx
<ToggleGroup>
  <ToggleGroupItem>A</ToggleGroupItem>
  <ToggleGroupItem>B</ToggleGroupItem>
  <ToggleGroupItem>C</ToggleGroupItem>
</ToggleGroup>
```

## Props

<div className="flex flex-row gap-x-3">
  <ExternalLink
    href="https://base-ui.com/react/components/toggle-group"
    text="Docs"
  />
  <ExternalLink
    href="https://base-ui.com/react/components/toggle-group#api-reference"
    text="API Reference"
  />
</div>

### Animate UI Props

#### ToggleGroup

<TypeTable
  type={{
    transition: {
      description: 'The transition of the toggle group',
      type: 'Transition',
      required: false,
      default: "{ type: 'spring', bounce: 0, stiffness: 200, damping: 25 }",
    },
    activeClassName: {
      description: 'The class name of the active toggle group item',
      type: 'string',
      required: false,
    },
    variant: {
      description: 'The variant of the toggle group',
      type: 'default' | 'outline',
      required: false,
      default: 'default',
    },
    size: {
      description: 'The size of the toggle group',
      type: 'default' | 'sm' | 'lg',
      required: false,
      default: 'default',
    },

}}
/>

#### ToggleGroupItem

<TypeTable
  type={{
    children: {
      description: 'The children of the toggle group item',
      type: 'React.ReactNode',
      required: true,
    },
    buttonProps: {
      description: 'The props of the toggle group item button',
      type: 'HTMLMotionProps<"button">',
      required: false,
    },
    spanProps: {
      description: 'The props of the toggle group item span',
      type: 'React.HTMLAttributes<HTMLSpanElement>',
      required: false,
    },
    variant: {
      description: 'The variant of the toggle group item',
      type: 'default' | 'outline',
      required: false,
      default: 'default',
    },
    size: {
      description: 'The size of the toggle group item',
      type: 'default' | 'sm' | 'lg',
      required: false,
      default: 'default',
    },
  }}
/>

## Credits

- We use [Base UI](https://base-ui.com/react/components/accordion) for the accordion component.
- We take our inspiration from [Shadcn UI](https://ui.shadcn.com/docs/components/accordion) for the accordion style.
