Skip to Content
Liquid Glass UI
Components

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 discrete Toggle buttons, compatible with variant="outline".
  • Liquid Glass toolbar (glass): Renders the group inside a shared Regular - Small Liquid Glass capsule with Over-Glass child items and solid accent pressed states.

Liquid Glass Toolbar

apple-liquid-ui/preview/toggle-liquid-hero
MacBook · 16:10

Installation (Shadcn Registry)

npx shadcn@latest add @apple-liquid/toggle-group

Segmented Control

First group is controlled single-select; second group is size="sm" multi-select text segments:

apple-liquid-ui/preview/toggle-group-segmented
MacBook · 16:10

Spaced & Vertical Orientation

apple-liquid-ui/preview/toggle-group-spacing
MacBook · 16:10

Over-Glass Surface Adaptation

apple-liquid-ui/preview/toggle-over-glass
MacBook · 16:10

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

PropTypeDefaultDescription
spacingnumber0Gap between items (Tailwind spacing scale); 0 renders a Segmented Control
glassbooleantrueRenders 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
multiplebooleanfalseAllow multiple items to be pressed simultaneously
value / defaultValuestring[]—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.

On this page