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.
Fully compatible with the standard shadcn/ui JSX API (<Toggle pressed onPressedChange defaultPressed>), preserving default and outline variants tuned to Apple 27 specs:
- Pressed state: Uses solid theme accent fill with white icon (
Segmented Controls / On), reacting live to the global Accent Color. - Orthogonal
glassmaterial: Renders as aRegular - SmallLiquid Glass toolbar button by default; accent fill layers cleanly over glass when pressed. - Automatic Over-Glass switching: Inside glass surfaces (Card, Popover, Sheet, etc.),
glassautomatically yields to flat Over-Glass styling.
Liquid Glass Toolbar
Installation (Shadcn Registry)
npx shadcn@latest add @apple-liquid/toggleVariants & Sizes
Top row shows default, outline, glass, and disabled; bottom row shows sm, default, and lg in pressed state:
Responsive Sizing
| Size | Mobile (iOS 27) | Desktop (macOS 27) |
|---|---|---|
sm | 34px | 24px (Regular Toolbar / Segmented) |
default | 44px (HIG minimum touch target) | 28px (Large) |
lg | 48px (Toolbar 48pt) | 36px (XL) |
Over-Glass Surface Adaptation
Usage
import { BoldIcon } from 'lucide-react';
import { Toggle } from '@/components/ui/toggle';
export function Example() {
return (
<Toggle glass aria-label="Bold">
<BoldIcon />
</Toggle>
);
}Props API
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'default' | 'outline' | 'default' | default borderless toolbar toggle, outline neutral Bordered fill |
size | 'sm' | 'default' | 'lg' | 'default' | Responsive size scale (see table above) |
glass | boolean | true | Liquid Glass control material; false renders 100% opaque Bordered equivalent; auto-switches to Over-Glass on glass surfaces |
surface | 'content' | 'over-glass' | Auto-detected | Manually override surface context |
pressed / defaultPressed | boolean | — | Controlled / uncontrolled pressed state |
onPressedChange | (pressed: boolean) => void | — | Callback fired when pressed state changes |
disableMotion | boolean | false | Disable press spring scale animation (respects prefers-reduced-motion) |
Toast
Apple macOS 27 top-right and iOS 27 top-center Liquid Glass notification banners supporting stacked hover expansion, swipe dismissal, and semantic status icons.
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.