Components
- Accordion
- Action BarUpdated
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- BadgeUpdated
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- CalendarUpdated
- CardUpdated
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context MenuUpdated
- Data List
- Date Picker
- DialogUpdated
- DrawerUpdated
- Editable
- FieldUpdated
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- MarqueeUpdated
- Menu
- Native Select
- Number InputUpdated
- 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
- TableUpdated
- Tabs
- Textarea
- TimerUpdated
- ToastUpdated
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Hooks
Installation#
pnpm dlx shadcn@latest add @shark/toggle-group
Anatomy#
ToggleGroup └── ToggleGroupItem
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#
States#
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.