> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# 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

```bash
npx @blotch/dolan add glass
```

```typescript
import { UiGlass, UiGlassGroup } from '../components/ui/glass';
```

:::tip
This also adds [Icon](/dolan/icon.md), whose copy of the theme colors resolves the glass's tint.
:::

## Usage

Put `ui-glass` on a `<blur-view>`:

```angular-html
<blur-view ui-glass class="flex-row items-center gap-2 px-4 py-2">
  <ui-icon name="music" />
  <text class="text-glass-foreground">Now playing</text>
</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 import `LYNX_ELEMENTS` in 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`** (and `text-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

| Platform                                      | What you get                                                               |
| --------------------------------------------- | -------------------------------------------------------------------------- |
| iOS 26 and later                              | Liquid Glass, drawn by iOS                                                 |
| iOS 15 to 25                                  | A blur material, Apple's design before Liquid Glass (see below)            |
| Android                                       | An opaque Material surface with a shadow, in the theme's `secondary` color |
| Android, with `provideGlass()` (below)        | A blur with a white sheen, a tint and a rim: glass without the refraction  |
| [Web preview](/guide/glossary.md#web-preview) | Liquid Glass, drawn with WebGL                                             |

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:

```typescript title="src/app/app.config.ts"
import { provideGlass } from '../components/ui/glass';

export const appConfig: ApplicationConfig = {
  providers: [
    provideZonelessChangeDetection(),
    provideRenderer(),
    provideGlass({ android: 'glass' }), // [!code highlight]
  ],
};
```

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](/dolan/dynamic-color.md).

### Variants

```angular-html
<blur-view ui-glass>…</blur-view>
<blur-view ui-glass variant="clear">…</blur-view>
```

- **`regular`** (the default) frosts what's behind it. It suits most controls.
- **`clear`** barely 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:

```angular-html
<view class="h-[52px] w-[52px] rounded-full bg-glass-dim">
  <blur-view ui-glass variant="clear" shape="circle" class="h-[52px] w-[52px]">
    <ui-icon name="play" />
  </blur-view>
</view>
```

### Shapes

```angular-html
<blur-view ui-glass shape="capsule">…</blur-view>
<blur-view ui-glass shape="circle" class="h-12 w-12">…</blur-view>
<blur-view ui-glass shape="rounded" [radius]="24">…</blur-view>
```

- **`capsule`** (the default) has fully rounded ends, like most glass controls.
- **`circle`** needs an equal width and height.
- **`rounded`** has `radius` px corners, `20` by 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.

```typescript
import { concentricRadius } from '../components/ui/glass';

// A card inset 8px inside 24px glass corners gets 16px corners.
readonly innerRadius = concentricRadius(24, 8);
```

A capsule inset evenly inside a capsule is already concentric.

### Tint

```angular-html
<blur-view ui-glass tint="var(--glass-tint)">
  <text class="text-glass-tint-foreground">Save</text>
</blur-view>
```

- **`tint`** takes a theme token, such as `var(--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

```angular-html
<blur-view ui-glass interactive (bindtap)="play()">…</blur-view>
```

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

```angular-html
<blur-view ui-glass material="thin">…</blur-view>
```

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:

| `material`          | What it's for                                                 |
| ------------------- | ------------------------------------------------------------- |
| `ultra-thin`        | The most translucent: the most of what's behind stays in view |
| `thin`              | Buttons floating over content                                 |
| `regular` (default) | Menus, popovers and alerts                                    |
| `thick`             | The most opaque: the most contrast for text and fine detail   |
| `chrome`            | Bars: tab bars, navigation bars and toolbars                  |

- **The Dolan components pick theirs:** `chrome` for the dock, navigation bar and toolbar, `thin` for glass buttons and button groups, and `regular` for menus, popovers and alert dialogs.
- **It follows your app's theme** (see [Dark mode](#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 ios`](/guide/building-for-production.md) builds.** 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:

```angular-html
<blur-view ui-glass-group [spacing]="16" class="flex-row items-center gap-3">
  <blur-view ui-glass class="h-14 flex-1 flex-row">…</blur-view>
  <blur-view ui-glass shape="circle" class="h-14 w-14">…</blur-view>
</blur-view>
```

- **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 with `visibility`, 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 app [`ng build --platform ios`](/guide/building-for-production.md) builds: 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.

```angular-html
<blur-view ui-glass-group class="relative h-[200px]">
  @if (composing()) {
    <blur-view
      ui-glass
      shape="rounded"
      glassId="compose"
      class="absolute bottom-0 left-0 right-0 top-0 p-4"
    >
      …
    </blur-view>
  } @else {
    <blur-view
      ui-glass
      shape="circle"
      interactive
      glassId="compose"
      class="absolute bottom-0 right-0 h-14 w-14"
      (bindtap)="composing.set(true)"
    >
      …
    </blur-view>
  }
</blur-view>
```

- **Swap them in one update:** remove or hide one shape and add or show the other, as `@if` and `@else` do.
- **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](/dolan/menu.md), [popovers](/dolan/popover.md) and [sheets](/dolan/sheet.md#from-the-button-that-presents-it) do with a glass button.
- **It's iOS 26, in the app `ng build --platform ios` builds.** 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](/dolan/theming.md#dark-mode) 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')`](/guide/dark-mode.md#keep-to-one-appearance)) keeps light glass under its dark text.

## API

### UiGlass

Selector: `blur-view[ui-glass]`.

| Input         | Type                                                         | Default     | Description                                                             |
| ------------- | ------------------------------------------------------------ | ----------- | ----------------------------------------------------------------------- |
| `variant`     | `'regular' \| 'clear'`                                       | `'regular'` | Frosted glass, or clear glass for over media.                           |
| `shape`       | `'capsule' \| 'circle' \| 'rounded'`                         | `'capsule'` | The glass's outline.                                                    |
| `radius`      | `number`                                                     | `20`        | Corner radius of a `rounded` shape, in px.                              |
| `tint`        | `string`                                                     | —           | A theme token (`var(--glass-tint)`) or a CSS color.                     |
| `interactive` | `boolean`                                                    | `false`     | Reacts to touch. iOS 26 and the web preview.                            |
| `material`    | `'ultra-thin' \| 'thin' \| 'regular' \| 'thick' \| 'chrome'` | `'regular'` | The blur material before iOS 26 (see above).                            |
| `glassId`     | `string`                                                     | —           | Pairs the shape with another to morph into (see [Morphing](#morphing)). |

Components built on the glass read these signals:

| Signal       | Type                                 | Description                                                                  |
| ------------ | ------------------------------------ | ---------------------------------------------------------------------------- |
| `design`     | `'glass' \| 'frosted' \| 'material'` | The look on this platform (see `GlassDesign`), for the component's own form. |
| `surface`    | `'glass' \| 'frosted' \| 'solid'`    | What this glass draws, after the user's settings.                            |
| `foreground` | `string`                             | The `var()` of the color for text and icons on it.                           |

### UiGlassGroup

Selector: `blur-view[ui-glass-group]`.

| Input     | Type     | Default | Description                                                                                 |
| --------- | -------- | ------- | ------------------------------------------------------------------------------------------- |
| `spacing` | `number` | `0`     | How close two glass shapes come before they start to merge, in px. They join at half of it. |

### Functions

| Function                         | Description                                                                                            |
| -------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `provideGlass({ android })`      | App-wide options. `android: 'glass'` gives Android glass instead of Material.                          |
| `injectGlassDesign()`            | A signal of the platform's design, `'glass'`, `'frosted'` or `'material'`, for a component's own form. |
| `injectSystemDrawsGlass()`       | `true` on iOS, which adapts its own glass to the user's settings.                                      |
| `concentricRadius(outer, inset)` | The corner radius for a shape `inset` px inside `outer` px corners.                                    |

### Theme colors

| Token                                         | Tailwind classes                                       | Used for                                  |
| --------------------------------------------- | ------------------------------------------------------ | ----------------------------------------- |
| `glass-foreground` / `glass-muted-foreground` | `text-glass-foreground`, `text-glass-muted-foreground` | Text and icons on glass                   |
| `glass-clear-foreground`                      | `text-glass-clear-foreground`                          | Text on clear glass, white in both themes |
| `glass-tint` / `glass-tint-foreground`        | `bg-glass-tint`, `text-glass-tint-foreground`          | Tinted glass, and what sits on it         |
| `glass-dim`                                   | `bg-glass-dim`                                         | The dimming layer under clear glass       |

`dolan add glass` doesn't change your theme. A theme copied before these colors existed lacks them: run [`dolan update`](/dolan/cli.md#update) if you haven't edited it, and [`dolan doctor`](/dolan/cli.md#doctor) lists the lines to add if you have.

## Accessibility

Glass follows the user's display settings, which [`LynxAccessibilitySettings`](/api/angular-lynx/accessibility.md#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](/dolan/button.md#glass) and [Button Group](/dolan/button-group.md#glass): glass buttons, and a group of them on one glass background
- [Menu](/dolan/menu.md) and [Context Menu](/dolan/context-menu.md): glass menus built on it
- [Bottom Sheet](/dolan/bottom-sheet.md#glass) and [Sheet](/dolan/sheet.md#glass): glass sheets that float inset at half height and turn opaque at full height
- [Popover](/dolan/popover.md) and [Action Sheet](/dolan/action-sheet.md#from-its-control): glass that grows out of the control that opens it
- [Switch](/dolan/switch.md#glass) and [Slider](/dolan/slider.md#glass): controls whose thumb turns to glass while it's touched
- [Alert Dialog](/dolan/alert-dialog.md#glass): the platform's own alert, on glass from iOS 26
- [`<blur-view>`](/api/elements/blur-view.md): the element under the glass
- [Theming](/dolan/theming.md): the theme colors
- [Dock](/dolan/dock.md): a floating glass tab bar built on it
- [Navigation Bar](/dolan/navigation-bar.md) and [Toolbar](/dolan/toolbar.md): glass bars at the top and bottom of a screen, with the scroll edge effect
- [Search Field](/dolan/search-field.md): a glass search field built on it
- [Toggle](/dolan/toggle.md#segmented-control) and [Tabs](/dolan/tabs.md#segmented-control): segmented controls whose thumb lifts into glass as it slides
- [Tab Bar](/dolan/tab-bar.md): bottom navigation without glass
- [Accessibility settings](/api/angular-lynx/accessibility.md#lynxaccessibilitysettings)
