# Toggle group: Icons and labels

> Put an icon before the label. Icon-only items need an aria-label.

Example: https://hextaui.com/docs/toggle-group/examples/icons
Component docs: https://hextaui.com/docs/toggle-group.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/toggle-group-icons.json
```

This adds `components/examples/toggle-group/icons.tsx` with the Toggle group component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/toggle-group/icons.tsx"
import { IconDeviceDesktop, IconMoon, IconSun } from "@tabler/icons-react"

import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

export function ToggleGroupIcons() {
  return (
    <ToggleGroup aria-label="Theme" defaultValue={["system"]}>
      <ToggleGroupItem value="light">
        <IconSun />
        Light
      </ToggleGroupItem>
      <ToggleGroupItem value="dark">
        <IconMoon />
        Dark
      </ToggleGroupItem>
      <ToggleGroupItem value="system">
        <IconDeviceDesktop />
        System
      </ToggleGroupItem>
    </ToggleGroup>
  )
}
```

## Props in this example

### ToggleGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | `string[]` | – |  |

### ToggleGroupItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` | – | Identifies the item in the group's value. |

## More Toggle group examples

- [Outline](https://hextaui.com/docs/toggle-group/examples/outline.md)
- [Multiple](https://hextaui.com/docs/toggle-group/examples/multiple.md)
- [Sizes](https://hextaui.com/docs/toggle-group/examples/sizes.md)
- [Spacing](https://hextaui.com/docs/toggle-group/examples/spacing.md)
- [Vertical](https://hextaui.com/docs/toggle-group/examples/vertical.md)
- [Disabled](https://hextaui.com/docs/toggle-group/examples/disabled.md)
- [Controlled](https://hextaui.com/docs/toggle-group/examples/controlled.md)
- [Right to left](https://hextaui.com/docs/toggle-group/examples/rtl.md)
