This browser is not supported. The glass needs a Chromium browser or Electron. Why

@adamexu/glassv0.1.0 · MIT · React 19

Read itthroughthe glass.

Liquid Glass for React. Real refraction, fitted to measurements of iOS and drawn with SVG backdrop filters, in every Chromium browser and in Electron.

Drag the glass. These set the whole page.

Appearance
Tint amount
50%
Clear variant

01Refraction, not blur

A blur smears. Glass bends.

A CSS backdrop blur averages what is behind it. The glass displaces it: edges curve at the rim, light gathers along the top, the middle stays legible. Same backdrop, same shape, side by side.

backdrop-filter: blur(14px)CSS
<GlassEffect glass={{ variant: "clear" }} />@adamexu/glass

This browser is not supported. Open the page in a Chromium browser to see the glass.

02The headline component

The tab bar, all of it.

Press and slide across it and a lens follows your finger. Scroll and it shrinks into the selected tab. An accessory rides above it, search splits off into its own circle, and on a tablet it becomes a floating top bar with a sidebar.

  • Lens drag with the measured lift, stretch and springs
  • Minimize on scroll, bottom accessory, badges, More list
  • Tablet top bar and sidebar, keyboard and screen reader support
<TabView selection={tab} onSelectionChange={setTab}
  minimizeBehavior="onScrollDown"
  bottomAccessory={<NowPlaying />}>
  <Tab value="home" title="Home" icon={<House />}>…</Tab>
  <Tab value="search" role="search" …>…</Tab>
</TabView>

03Controls

Press a switch and its thumb lifts into a lens. Flick a slider past its end and it rubber-bands. Each one is a real form control with keyboard support, and each was fitted frame by frame.

04Presentations

Panels that grow out of what you touched.

Alerts lean after your finger. Menus open from their button and let you slide straight onto a row. Sheets follow the finger one to one and turn from glass to opaque at the top. Open them.

05Navigation and lists

NavigationStack slides pages over a dimmed, parallaxed parent and morphs the toolbar capsules between them. Large titles hand over to the inline title as they pass under the bar. Swipe from anywhere on a pushed page to go back.

  • List and Form in every iOS style, swipe actions, edit mode
  • Toolbar items, menus in the bar, navigation pickers
  • Rows press after 190 ms held still, just like the real thing

06Containers

Glass that merges and morphs.

Inside a GlassEffectContainer, nearby glass melts together and changes shape as one piece, the way iOS draws it: a single signed-distance field, one filter for the whole group.

07Install

One package. No config.

ESM with types, every component a client component, unused ones tree-shaken. Works in Next, Vite and Electron as is. React 19 or newer.

terminal
npm i @adamexu/glass
app.tsx
import { Button, GlassEffect, GlassProvider } from "@adamexu/glass";

export function App() {
  return (
    <GlassProvider scheme="light">
      <GlassEffect shape={{ type: "capsule" }} width={240} height={72}>
        Hello
      </GlassEffect>
      <Button buttonStyle="glassProminent">Continue</Button>
    </GlassProvider>
  );
}

08How it works

Measured, not eyeballed.

Every number in the material came from the simulator: fields read with phase-shifted stripes, springs fitted from frame-by-frame films, colours sampled over black, gray and white. Then it had to run at 120 Hz in a browser.

  1. 1

    Frost

    A blur sized from tables measured per glass size, so a small button and a big panel frost the way iOS frosts them.

  2. 2

    Lens and glow

    Displacement maps bend the backdrop at the rim. Light gathers from just outside the edge, as it does on the device.

  3. 3

    Tone, chroma, tint

    A fitted colour finish for light and dark, at any tint amount from clear to tinted, plus your own tint colour.

3stages
Three stacked backdrop-filter layers per glass, a fourth when tinted, each changing pixels only inside its shape. Splitting the one big filter took a scrolling tablet bar from 30 to 120 fps.
4workers
Glass maps rasterize in a pool of up to four module workers, and the controls' lenses in workers of their own. A worker that cannot load hands its jobs to the main thread.
Grayonly
Chrome colour-manages filter images into the display profile. Only grays survive that, so every map is gray.
sRGBmath
On a P3 display the filter sees P3 values. Every fitted step converts to sRGB first and back at the end.
0passes
Glass in a list row moves with everything it reads, so at rest it is baked into the scroller's own tiles and scrolling it costs nothing.
~110per frame
Graphite render passes Chrome fits in a 120 Hz frame. A live glass takes 65 to 95 of them.

09Browser support

Built for Chromium. Made for Electron.

The glass is SVG filters running as backdrop filters, which only Chromium draws. Other browsers are not supported, and there is no fallback, so ship it where Chromium is the renderer.

Supported

  • Chrome
  • Edge
  • Arc
  • Brave
  • Opera
  • Android Chrome
  • Electron

Not supported

  • Safari
  • Firefox
  • Every browser on iOS

A great fit for desktop apps

Electron ships Chromium, so every user gets the real glass. The maps build in module workers your bundler emits with the renderer, so a strict CSP only has to allow workers from your own origin. The repo has a working example.

Check before you ship

The package has no fallback and does not check the browser. This site reads Chromium's UA brands and shows a note in other browsers. Do the same in your app if it can open outside Chromium.