Components
- Accordion
- Action Bar
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context Menu
- Data List
- Date Picker
- Dialog
- Drawer
- Editable
- Field
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- Table
- Tabs
- Textarea
- Timer
- Toast
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add https://shark.vini.one/r/toggle-group.json
Usage
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
<ToggleGroup> <ToggleGroupItem value="1">Item 1</ToggleGroupItem> <ToggleGroupItem value="2">Item 2</ToggleGroupItem> </ToggleGroup>
Orientation
Use orientation to change the orientation of the toggle group.
Horizontal
Vertical
Variant
Use variant to change the visual style of the toggle buttons.
Ghost
Outline
State
Disabled
Disable the entire group with the disabled prop.
With disabled toggle
Disable individual toggles by setting disabled on a specific item.
Examples
With spacing
Use spacing to add space between buttons.
Single selection
Use multiple={false} to allow only one toggle to be selected at a time.
Custom toggle group
A custom toggle group example with tooltips and custom styling for font weight selection.
Font Weight
API Reference
ToggleGroup
Root component. Provides shared variant and size to child toggles via context.
| Prop | Type | Default |
|---|---|---|
variant | "outline" | "ghost" | "ghost" |
size | "sm" | "md" | "lg" | "md" |
spacing | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 0 |
multiple | boolean | true |
defaultValue | string[] | - |
value | string[] | - |
onValueChange | (details: ValueChangeDetails) => void | - |
orientation | "horizontal" | "vertical" | "horizontal" |
disabled | boolean | false |
className | string | - |
| Attribute | Default |
|---|---|
--gap | Set from the spacing prop (default 0) |
ToggleGroupItem
Single toggle in the group. Uses <Toggle /> internally.
| Prop | Type | Default |
|---|---|---|
value | string | required |
disabled | boolean | false |
className | string | - |
aria-label | string | - |
For a complete list of props, see the Ark UI documentation.