Liquid Glass and fallbacks
Shared native materials, accessible fallbacks and honest platform support.
Use glass for navigation, floating controls and menus. On cards, place the material where it can pick up photo, artwork or colour from behind the surface. Use solid fills for dense reading surfaces.
Ready-made components
Glass lives in navigation and in the theme. Tab bar glass action, Header search and Bottom accessory bring their shared material dependencies with them. Cards, panels, menus and tooltips take the Glass material from GlassThemeProvider below, so there is no separate glass version of each control.
Glass across a screen
import { GlassThemeProvider } from '@/components/swipeui/lib/glass-theme';
import { ThemeProvider } from '@/components/swipeui/lib/theme';
<ThemeProvider preset="cinema" scheme="system">
<GlassThemeProvider material="glass">
<App />
</GlassThemeProvider>
</ThemeProvider>;Use the Pro glass-theme companion when authenticated Pro distribution is available. With no material prop, the provider reads --swipeui-material from the active scheme in swipeui-theme.css. The app can share one palette and opt individual subtrees into Glass or solid. The decorative surface follows each participating component. Info Card uses it for its panel. The Credit Card preview uses it on the surrounding controls and retains the printed card face. System navigation chrome belongs to the OS.
Status colors
Switching between Solid and Glass keeps the component’s existing label and icon colors, including red destructive text and green success icons. Menu panels and group trays own the material. Filled actions keep their original fill beneath a clear Glass layer, so the foreground stays paired with the fill chosen for it. Dedicated feedback surfaces can use the active preset’s success, destructive, warning or info color as a wash or edge. Reduce Transparency keeps the original fill or uses an opaque fallback with the same status treatment.
Glass for cards
Choose Glass under Material in a component preview. Preset controls the palette and shape. For example, Cinema keeps its rectangular actions with either material. The website renders browser blur for the surfaces in the preview. The native showcase uses the same component roles with native material and its fallback.
The Pro glass-theme-cards item supplies a scoped appearance for existing cards. Install the companion with npx @swipeui/cli add glass-theme-cards when authenticated Pro distribution is available. Existing Free cards keep their own installs and default styling.
import { InfoCard } from '@/components/swipeui/card/info-card';
import { GlassCardThemeProvider, useGlassCardTheme } from '@/components/swipeui/lib/glass-theme-cards';
function PlanCard() {
const glass = useGlassCardTheme();
return <InfoCard title="Weekend plans" surfaceBackground={glass?.('sheet')} />;
}
<GlassCardThemeProvider enabled={useGlass}>
<PlanCard />
</GlassCardThemeProvider>;| Card | Glass treatment |
|---|---|
| Cover | On-card action and preview placement controls |
| Expandable, Info, Product Spotlight, Table | Card surfaces |
| Metric | Card surface and range control |
| Food | Outline, Filled and Elevated card surfaces |
| Boarding Pass, Card Stack, Flip, Time-of-day | Preview controls |
| Minimal Listing | Existing card and controls |
Custom surfaces
Glass surface is free. It owns the policy shared by glass controls and the updated glass bar. auto chooses the best supported material. Forced glass or blur still falls back when unsupported; Reduce Transparency always selects opaque.
| Environment | Material |
|---|---|
| iOS 26+, both glass availability checks pass, transparency permitted | Native Liquid Glass |
| Other supported iOS versions | Blur |
| Android with an explicit BlurTargetView ref | Blur using the documented blur method |
| Android without a blur target, web, or Reduce Transparency enabled | Opaque surface-elevated |
The Glass card previews use browser blur to show the intended composition and a solid fill under Reduce Transparency. Native glass and optical merging are verified on device.
Composition
import { GlassSurface, GlassSurfaceGroup } from '@/components/swipeui/glass/glass-surface';
<GlassSurfaceGroup spacing={12} style={{ flexDirection: 'row', gap: 8 }}>
<GlassSurface className="p-4"><Text>Navigation</Text></GlassSurface>
<GlassSurface className="p-4"><Text>Action</Text></GlassSurface>
</GlassSurfaceGroup>;Nearby shapes merge only where native glass is supported. Elsewhere, the group preserves layout as an ordinary view. The caller owns padding and safe areas; nested controls must not add them again.
Native glass and its ancestors must remain fully opaque. Use shared role-based transforms or material style changes. Glass menus use the overlay host's animateOpacity={false} option, retaining backdrop animation and focus/dismissal behavior. Do not put a glass menu inside another fading ancestor.
Use regular glass for navigation. Reserve clear glass for media-backed surfaces. Android blur needs a BlurTargetView around the content and a matching blurTarget ref. Render the material after dynamic content; clip rounded blur surfaces.
Verification
Test both schemes, all five presets, RTL, large text, narrow containers and active resize. Verify Reduce Transparency and Reduce Motion separately. Current unit/browser/bundle checks do not establish native materials or bare styling compatibility. Native rendering, accessibility and recordings remain scheduled under Phase 7.9.