ToggleGroup
ToggleGroup groups multiple Toggles together to manage on/off state. Supports both single and multiple selection modes.
Playground
<ToggleGroup type="single" variant="outline" defaultValue="grid">
<ToggleGroup.Item value="grid" aria-label="Grid view">
<LayoutGrid />
</ToggleGroup.Item>
<ToggleGroup.Item value="list" aria-label="List view">
<List />
</ToggleGroup.Item>
</ToggleGroup>Types
Variants
Sizes
Icon Only
xssmmddefaultlg| Size | Height | H. Padding | Icon | Preview |
|---|---|---|---|---|
xs | 28px | 10px | 14px | |
sm | 32px | 12px | 14px | |
md | 36px | 14px | 16px | |
default | 40px | 16px | 16px | |
lg | 48px | 24px | 16px |
Icon + Text
xssmmddefaultlg| Size | Height | H. Padding | Gap | Icon | Font | Preview |
|---|---|---|---|---|---|---|
xs | 28px | 10px | 4px | 14px | 12px | |
sm | 32px | 12px | 8px | 14px | 13px | |
md | 36px | 14px | 8px | 16px | 14px | |
default | 40px | 16px | 8px | 16px | 14px | |
lg | 48px | 24px | 8px | 16px | 16px |
Features
Use Cases
Finder, Dropbox, e-commerce product listings
Figma, Framer, Flexbox direction toggle
Gmail, Notion, task management apps
// Grid/List toggle - Finder, Dropbox style
<ToggleGroup type="single" variant="outline" defaultValue="grid">
<ToggleGroup.Item value="grid" aria-label="Grid view">
<LayoutGrid />
</ToggleGroup.Item>
<ToggleGroup.Item value="list" aria-label="List view">
<List />
</ToggleGroup.Item>
</ToggleGroup>
// Row/Column layout - Figma, Framer style
<ToggleGroup type="single" variant="outline" defaultValue="rows">
<ToggleGroup.Item value="rows" aria-label="Rows">
<Rows />
</ToggleGroup.Item>
<ToggleGroup.Item value="columns" aria-label="Columns">
<Columns />
</ToggleGroup.Item>
</ToggleGroup>
// Card/Compact/Detail - Gmail, Notion style
<ToggleGroup type="single" variant="outline" defaultValue="card">
<ToggleGroup.Item value="card" aria-label="Card view"><Grid /></ToggleGroup.Item>
<ToggleGroup.Item value="compact" aria-label="Compact view"><List /></ToggleGroup.Item>
<ToggleGroup.Item value="detail" aria-label="Detail view"><Rows /></ToggleGroup.Item>
</ToggleGroup>States
Default
Normal state. Selected item is highlighted.
Disabled
All items are disabled.
Individual Disabled
Only specific items are disabled.
Multiple Selection
Multiple items can be selected simultaneously.
Orientation
Horizontal (Default)
Vertical
API
Component Structure
ToggleGroup— Radix ToggleGroup.ItemPropsToggle itemProps
ToggleGroup
type—"single" | "multiple"Single or multiple selection mode
valueundefinedstring | string[]Selected value in controlled mode
defaultValueundefinedstring | string[]Initial selected value in uncontrolled mode
onValueChangeundefined(value) => voidCallback fired on selection change
variant"default""default" | "outline"Visual style of items
size"default""xs" | "sm" | "md" | "default" | "lg"Item size (28/32/36/40/48px)
radius"default""none" | "sm" | "base" | "default" | "lg" | "xl" | "2xl" | "3xl" | "full"Border radius size (6px)
fontWeight"normal""normal" | "semibold"Font weight applied to all items. Can be overridden per item via fontWeight
orientation"horizontal""horizontal" | "vertical"Layout direction
disabledfalsebooleanDisables all items
| Name | Type | Default | Description |
|---|---|---|---|
type | "single" | "multiple" | — | Single or multiple selection mode |
value | string | string[] | undefined | Selected value in controlled mode |
defaultValue | string | string[] | undefined | Initial selected value in uncontrolled mode |
onValueChange | (value) => void | undefined | Callback fired on selection change |
variant | "default" | "outline" | "default" | Visual style of items |
size | "xs" | "sm" | "md" | "default" | "lg" | "default" | Item size (28/32/36/40/48px) |
radius | "none" | "sm" | "base" | "default" | "lg" | "xl" | "2xl" | "3xl" | "full" | "default" | Border radius size (6px) |
fontWeight | "normal" | "semibold" | "normal" | Font weight applied to all items. Can be overridden per item via fontWeight |
orientation | "horizontal" | "vertical" | "horizontal" | Layout direction |
disabled | boolean | false | Disables all items |
ToggleGroup.Item
value—stringUnique value for this item
disabledfalsebooleanDisables this individual item
variantinherit"default" | "outline"Overrides variant for this item
sizeinherit"xs" | "sm" | "md" | "default" | "lg"Overrides size for this item
radiusinherit"none" | "sm" | ... | "full"Overrides radius for this item
fontWeightinherit"normal" | "semibold"Overrides font weight for this item
| Name | Type | Default | Description |
|---|---|---|---|
value | string | — | Unique value for this item |
disabled | boolean | false | Disables this individual item |
variant | "default" | "outline" | inherit | Overrides variant for this item |
size | "xs" | "sm" | "md" | "default" | "lg" | inherit | Overrides size for this item |
radius | "none" | "sm" | ... | "full" | inherit | Overrides radius for this item |
fontWeight | "normal" | "semibold" | inherit | Overrides font weight for this item |
Customization
All items use default values based on the design system spacing rules. Use the group'sclassNameto customize all items at once.
Change horizontal padding
className="[&>button]:px-10"Change Icon Only width
className="[&>button]:aspect-auto [&>button]:px-5"Tip:Default values are designed to maintain component consistency. Use customization only when required for your UI implementation.
Anatomy
Best Practices
Do
- ✓Use type="single" for single selection
- ✓Use type="multiple" for multiple selection
- ✓Set aria-label on each item
- ✓Group related options together
Don't
- ✗Don't include more than 5 items
- ✗Don't mix unrelated options
- ✗Don't use for navigation (→ use Tabs)
- ✗Don't use instead of Segmented for single selection
Accessibility
Keyboard
ARIA
role="group"Auto-appliedaria-pressedAuto-applieddata-orientationAuto-appliedaria-labelRecommended
ToggleGroup vs ButtonGroup
They look similar but differ in purpose and behavior. Choose the appropriate component.
Purpose
ToggleGroup: Manage on/off state
ButtonGroup: Group action buttons
State management
ToggleGroup: Automatic (Radix-managed)
ButtonGroup: Manual (selected prop)
Selection mode
ToggleGroup: single / multiple
ButtonGroup: Manual control only
Value management
ToggleGroup: value / onValueChange
ButtonGroup: None
Use case
ToggleGroup: Text alignment, formatting
ButtonGroup: Pagination, toolbars
| Feature | ToggleGroup | ButtonGroup |
|---|---|---|
| Purpose | Manage on/off state | Group action buttons |
| State management | Automatic (Radix-managed) | Manual (selected prop) |
| Selection mode | single / multiple | Manual control only |
| Value management | value / onValueChange | None |
| Use case | Text alignment, formatting | Pagination, toolbars |
Use ToggleGroup when you need to retain state (selected/unselected), and ButtonGroup when you want to trigger an action on click.