ToggleGroup
Combines into an Apple 27 Segmented Control at spacing={0} and a macOS 27 toolbar Liquid Glass segmented bar with glass, supporting single/multiple selection, vertical orientation, and automatic Over-Glass switching.
Fully compatible with the standard shadcn/ui JSX API (<ToggleGroup> + <ToggleGroupItem value>, supporting multiple, value / defaultValue / onValueChange, and orientation):
- Segmented Control (default
spacing={0}): Items share a single capsule surface (Segmented Controls / Content Area) with hairline dividers that automatically hide next to hovered or pressed items; pressed items fill with solid theme accent. - Spaced buttons (
spacing > 0): Renders discreteTogglebuttons, compatible withvariant="outline". - Liquid Glass toolbar (
glass): Renders the group inside a sharedRegular - SmallLiquid Glass capsule with Over-Glass child items and solid accent pressed states.
Liquid Glass Toolbar
Installation (Shadcn Registry)
npx shadcn@latest add @apple-liquid/toggle-groupSegmented Control
First group is controlled single-select; second group is size="sm" multi-select text segments:
Spaced & Vertical Orientation
Over-Glass Surface Adaptation
Usage
import { BoldIcon, ItalicIcon } from 'lucide-react';
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
export function Example() {
return (
<ToggleGroup glass multiple defaultValue={['bold']}>
<ToggleGroupItem value="bold" aria-label="Bold">
<BoldIcon />
</ToggleGroupItem>
<ToggleGroupItem value="italic" aria-label="Italic">
<ItalicIcon />
</ToggleGroupItem>
</ToggleGroup>
);
}Props API
ToggleGroup
| Prop | Type | Default | Description |
|---|---|---|---|
spacing | number | 0 | Gap between items (Tailwind spacing scale); 0 renders a Segmented Control |
glass | boolean | true | Renders as a shared Liquid Glass capsule; false renders 100% opaque Bordered Segmented Control; auto-disabled on glass surfaces |
variant | 'default' | 'outline' | — | Forwarded to items (applies when spacing > 0) |
size | 'sm' | 'default' | 'lg' | — | Forwarded item size |
orientation | 'horizontal' | 'vertical' | 'horizontal' | Layout orientation |
multiple | boolean | false | Allow multiple items to be pressed simultaneously |
value / defaultValue | string[] | — | Controlled / uncontrolled pressed item values |
onValueChange | (value: string[]) => void | — | Callback fired when pressed items change |
ToggleGroupItem
Inherits all Toggle props (except glass, which is controlled by the parent group); value is required.
Toggle
Toggle button aligned with macOS 27 toolbar and iOS 27 touch dimensions, featuring solid accent pressed state, orthogonal glass Liquid Glass material, and automatic Over-Glass switching.
Tooltip
Floating macOS 27 Liquid Glass tooltip pill with keyboard shortcut badge support, four-side anchoring, touch long-press adaptation, and glass={false} opaque mode.