# ToggleGroup

> A row of toggles with single or multiple selection.

- Category: [Inputs & forms](https://tarve.dev/docs.md#inputs)
- Import: `import { ToggleGroup } from "@tarve/core";`
- Props type: `ToggleGroupProps`
- Source: [packages/core/src/form-controls.ts:366](https://github.com/omarcosr/tarve/blob/main/packages/core/src/form-controls.ts#L366)

## Usage

```tsx title="ToggleGroup.tsx"
import { ToggleGroup } from "@tarve/core";

let alignment: string | string[] = "left";

<ToggleGroup
  type="single"
  value={alignment}
  items={[
    { value: "left", label: "Left" },
    { value: "center", label: "Center" },
    { value: "right", label: "Right" },
  ]}
  onValueChange={(value) => {
    alignment = value;
  }}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` (required) | `readonly ToggleGroupItem[]` | — |  |
| `value` (required) | `string \| string[]` | — |  |
| `disabled` | `boolean` | — |  |
| `glass` | `GlassProp` | — | One Liquid Glass capsule holding the items; the chosen ones get a bright pill. |
| `onValueChange` | `(value: string \| string[]) => void` | — |  |
| `type` | `"single" \| "multiple"` | `"single"` |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="GlassProp"
type GlassProp = boolean | GlassVariant | GlassOptions;
```

```ts title="ToggleGroupItem"
interface ToggleGroupItem {
  value: string;
  label: string;
  content?: Child;
  disabled?: boolean;
}
```

Previous: [Toggle](https://tarve.dev/docs/components/Toggle.md) · Next: [Calendar](https://tarve.dev/docs/components/Calendar.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/ToggleGroup · Index for agents: https://tarve.dev/llms.txt
