# ToggleGroup

Groups related toggles so users can select one or more options together. Use it for compact toolbars and view preferences.

Package: `@kela-systems/ui-components` 4.1.0

```tsx
import { ToggleGroup, ToggleGroupItem } from "@kela-systems/ui-components";
```

Links (Kela sign-in needed): [Storybook](https://main--6af1efd9453270bb59a6c00c.chromatic.com/?path=/docs/components-togglegroup--docs), [Source](https://github.com/Kela-Systems/kela/tree/main/packages/next/ui-components/src/toggle-group), [Figma](https://www.figma.com/design/anhlwrbFM6mUiL0klxeK1I/ARK---Design-System?node-id=123-75)

## Examples

### Default

```tsx
import { ToggleGroup, ToggleGroupItem } from "@kela-systems/ui-components";

export default function ToggleGroupDefault() {
  return (
    <ToggleGroup defaultValue={["map"]} aria-label="View">
      <ToggleGroupItem value="map">Map</ToggleGroupItem>
      <ToggleGroupItem value="video">Video</ToggleGroupItem>
      <ToggleGroupItem value="split">Split</ToggleGroupItem>
    </ToggleGroup>
  );
}
```

## Props

A `className` on a part adds layout only: placement, sizing and spacing. Pick a look with a variant.

### ToggleGroup

| Variant | Values | Default |
| --- | --- | --- |
| `orientation` | `horizontal`, `vertical` | `horizontal` |
| `variant` | `default`, `outline` | `outline` |
| `size` | `default`, `sm`, `lg` | `default` |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `spacing` | `number` | `2` | Gap between items in scale steps, so 2 is 8px. 0 joins them. |
| `fill` | `boolean` | `false` | Stretches the items to fill the group's width. |

Also takes the props of `@base-ui/react/toggle-group`.

### ToggleGroupItem

| Variant | Values | Default |
| --- | --- | --- |
| `variant` | `default`, `outline` | `outline` |
| `size` | `default`, `sm`, `lg` | `default` |

Also takes the props of `@base-ui/react/toggle`.
