Glass
Liquid Glass for the controls and bars that float over your content. One element draws Apple's glass on iOS 26, and the right fallback everywhere else.
Installation
This also adds Icon, whose copy of the theme colors resolves the glass's tint.
Usage
Put ui-glass on a <blur-view>:
- The
<blur-view>is the glass. Size it, place it and lay out its content with classes, as you would a<view>. It's the Lynx element that blurs, so importLYNX_ELEMENTSin your component. - Content goes inside it. On iOS, interactive glass only reacts to touches on itself and what's in it.
- Color text with
text-glass-foreground(andtext-glass-muted-foreground). The glass points them at the right color for its variant and the user's contrast setting.<ui-icon>s inside get the same color. - Use glass sparingly, on the controls and bars that float above the content, never on the content itself. Don't put glass on glass.
What each platform draws
On Android, apps usually look like Android: Material 3 relies on color and shape rather than glass. To get glass there too, opt in for the whole app:
Android's glass blurs live, with RenderEffect from Android 12. On older phones the blur costs more.
The Material design draws in your theme's colors. To draw it in the colors of the user's wallpaper, as other Android apps do, add Dynamic Color.
Variants
regular(the default) frosts what's behind it. It suits most controls.clearbarely frosts it, for controls over photos and video. Text on it turns white.- Don't mix the two on one screen.
Clear glass over bright content needs a dark layer under it, at about a third, so the white stays legible. Put a bg-glass-dim view behind the glass:
Shapes
capsule(the default) has fully rounded ends, like most glass controls.circleneeds an equal width and height.roundedhasradiuspx corners,20by default.
A shape nested inside a rounded one looks right when its corners share the outer corners' centers. concentricRadius() works out its radius: the outer radius minus the gap between them.
A capsule inset evenly inside a capsule is already concentric.
Tint
tinttakes a theme token, such asvar(--glass-tint), or any CSS color.- Keep it for the screen's main action. Color in glass controls should be rare.
- Without glass, the tint fills the control, as a filled button does: on Android's Material surface, and on iOS 15 to 25's frosted material.
Interactive
The glass swells and brightens under the finger, as iOS 26's glass controls do. It works on iOS 26 and in the web preview.
Materials before iOS 26
iOS 15 to 25 has no Liquid Glass, so the glass draws one of UIKit's blur materials instead, as Apple's design of that time did. Apple gave each kind of control its own, and material picks it:
- The Dolan components pick theirs:
chromefor the dock, navigation bar and toolbar,thinfor glass buttons and button groups, andregularfor menus, popovers and alert dialogs. - It follows your app's theme (see Dark mode). Clear glass draws the material's dark form in either theme, as Apple's controls over photos and video did.
- Liquid Glass ignores it. iOS 26 and later, Android and the web preview draw the same glass for every
material. - The materials come with the iOS app that
ng build --platform iosbuilds. Lynx's own<blur-view>doesn't have them, so in Lynx Explorer the glass draws Lynx's older blur instead: white, or dark in dark mode and for clear glass.
Groups
ui-glass-group merges the glass inside it, as iOS draws a group of glass controls. Shapes closer than spacing px reach toward each other, and join into one once the gap between them is under half of it:
- Put the glass directly inside the group. A wrapper that draws anything itself comes between them.
- Shapes merge on iOS 26 and in the web preview. Android's glass doesn't merge.
- Moving or resizing a shape morphs the glass with it, with a CSS transition for example.
- Glass that comes and goes materializes and dissolves. A shape you add or remove (
@if), or show and hide withvisibility, fades in or out the way UIKit's glass does, and a change of tint or variant eases to the new one. That's on iOS 26, in the appng build --platform iosbuilds: in Lynx Explorer, on Android and in the web preview the shape appears and disappears at once.
Morphing
Give two shapes the same glassId, and when one replaces the other, the group morphs the first into the second, as SwiftUI's glassEffectID does: here a button turns into the panel it opens, and back.
- Swap them in one update: remove or hide one shape and add or show the other, as
@ifand@elsedo. - In a group, the new shape grows out of the old one's frame and corners while the old one's glass flows into it, and the group merges the two as they move. The old content fades out and the new fades in.
- Across groups or windows, such as a button in the page and a panel in an
<overlay>, the new shape takes over where it is: it starts from the old one's corners, and the old content fades out over it. Place it where the old one was and grow it from there, as the menus, popovers and sheets do with a glass button. - It's iOS 26, in the app
ng build --platform iosbuilds. Elsewhere one shape replaces the other at once, and under Reduce Motion the two cross-fade in place.
Dark mode
Glass follows the app's appearance, as the theme does: a light material in light mode and a dark one in dark mode. An app that stays light on a dark phone (provideColorScheme('light')) keeps light glass under its dark text.
API
UiGlass
Selector: blur-view[ui-glass].
Components built on the glass read these signals:
UiGlassGroup
Selector: blur-view[ui-glass-group].
Functions
Theme colors
dolan add glass doesn't change your theme. A theme copied before these colors existed lacks them: run dolan update if you haven't edited it, and dolan doctor lists the lines to add if you have.
Accessibility
Glass follows the user's display settings, which LynxAccessibilitySettings reads:
- Reduce Transparency turns the glass into a solid surface. iOS does this to its own glass. On Android and the web, the component draws the solid surface.
- Increase Contrast makes muted text full strength, and gives the glass a solid edge on Android and the web. iOS adds its own edge.
- Reduce Motion is for the components built on glass: they slide, minimize and morph less or not at all. iOS calms its own glass.
The apps ng build --platform makes send these settings. In Lynx Explorer, add them to the bundle URL to try them: ?reduceTransparency=true.
Related
- Button and Button Group: glass buttons, and a group of them on one glass background
- Menu and Context Menu: glass menus built on it
- Bottom Sheet and Sheet: glass sheets that float inset at half height and turn opaque at full height
- Popover and Action Sheet: glass that grows out of the control that opens it
- Switch and Slider: controls whose thumb turns to glass while it's touched
- Alert Dialog: the platform's own alert, on glass from iOS 26
<blur-view>: the element under the glass- Theming: the theme colors
- Dock: a floating glass tab bar built on it
- Navigation Bar and Toolbar: glass bars at the top and bottom of a screen, with the scroll edge effect
- Search Field: a glass search field built on it
- Toggle and Tabs: segmented controls whose thumb lifts into glass as it slides
- Tab Bar: bottom navigation without glass
- Accessibility settings
