--- title: Toggle Group description: Provides a shared state to a series of toggle buttons. links: doc: https://base-ui.com/react/components/toggle-group#api-reference --- ## Preview ## Installation CLI Manual ```bash npx @olyx/cli@latest add toggle-group ``` Install the following dependencies: ```bash npm install @base-ui/react ``` 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 Bold Italic Underline ``` ## API Reference ### ToggleGroup Root component. Styled wrapper for `ToggleGroup.Root` from Base UI. Provides shared variant and size to child toggles via context. | Prop | Type | Default | | --------- | ----------------------- | ----------- | | `variant` | `"primary" \| "ghost"` | `"primary"` | | `size` | `"sm" \| "md" \| "lg"` | `"md"` | | `grouped` | `boolean` | `true` | ### ToggleGroupItem Individual toggle button within the group. Styled wrapper for `Toggle.Root` from Base UI. Inherits variant and size from parent `ToggleGroup` context. All props from [Base UI ToggleGroup](https://base-ui.com/react/components/toggle-group#api-reference) are also supported. ## Examples ### Small ### Large ### Ghost ### Ungrouped ### Vertical ### Disabled