Glass surface
Shared Liquid Glass material with accessible blur and opaque fallbacks and merging groups.
npx @swipeui/cli add glass-surfaceVariant
Preset
Material
Scheme
Feel
When to use it
- Building your own floating controls, toolbars or panels that should use Liquid Glass on iOS 26.
- Any custom component that needs the same glass, blur and opaque fallbacks as SwipeUI's glass items.
- Grouping nearby glass shapes so they merge into one when they get close, like iOS buttons in a cluster.
- Overlays on photos, maps or video where a translucent surface keeps context visible.
When not to use it
- Ordinary cards and sections on a plain background. Card is lighter and easier to read.
- Long text or dense forms; glass lowers contrast behind text.
- Places where a ready-made glass item exists, such as Glass button, Glass toolbar or Glass tab bar.
- Apps that don't target iOS 26 and don't want blur; a solid surface token is simpler.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add glass-surface- Adds
components/swipeui/glass/glass-surface.tsxand 2 shared helpers. - Installs expo-glass-effect, expo-blur, uniwind, clsx, tailwind-merge. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { GlassSurface } from '@/components/swipeui/glass/glass-surface';
<GlassSurface className="p-4">
<Text>Navigation surface</Text>
</GlassSurface>;API reference
| Prop | Type | Default | Description |
|---|---|---|---|
material? | | | Preferred material; unsupported choices fall back. |
glassStyle? | | | Native glass style. |
isInteractive? | | | Enables native touch feedback. |
tinted? | | | Washes native glass with the |
blurTarget? | | — | Android requires a BlurTargetView ref for real blur. |
blurIntensity? | | | Blur strength. |
className? | | — | Token classes on the surface. |
Composition and behavior
- material prefers glass, blur or opaque (auto by default); unsupported choices fall back.
- glassStyle is regular or clear (for bars over photos and video).
- isInteractive enables native touch feedback on glass.
- Native glass is untinted, like the system bars, so it refracts what scrolls under it. tinted washes it with the glass-tint token for a flatter, more opaque panel.
- GlassSurfaceGroup merges neighbouring glass surfaces within spacing.
- Every SwipeUI glass item is built on this.
Behavior and gestures
- On its own it's a surface, not a control; it doesn't respond to touch unless you put buttons in it.
- isInteractive turns on the system's native glass touch shimmer for surfaces that act as buttons.
- The material picks itself: Liquid Glass on iOS 26+, blur where blur really works, otherwise the opaque elevated surface.
- Turning on Reduce Transparency switches to the opaque surface live.
- Inside GlassSurfaceGroup, glass shapes closer than spacing melt together as they move.
Accessibility
- Reduce Transparency always wins, even over a forced material, so text never sits on see-through glass for people who've asked for solid surfaces.
- The opaque fallback uses your surface-elevated token, which keeps theme contrast.
- The surface adds no accessible name; label the controls inside it.
- Avoid small or thin text on clear glass over busy imagery.
Motion
- Uses the
pressmotion role, so it follows your app's feel. Passmotionto tune this one instance. - The surface itself doesn't animate. Native glass handles its own shimmer and merging.
- Movement comes from what you put inside, such as Pressable's press scale.
Performance
- Liquid Glass is drawn by the system. Blur is only used where it really blurs.
- Android blur needs a BlurTargetView ref; without it the cheaper opaque surface is used.
Notes for AI
- Leave material on auto and let fallbacks work.
- Pass blurTarget on Android only when you've wrapped content in a BlurTargetView.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.