Liquid Glass

2026

A lightweight JavaScript library that recreates Apple's Liquid Glass visual effect, bringing fluid, glass-like interactions to web interfaces.

Technologies

About the project

Liquid Glass is a lightweight JavaScript library that recreates Apple’s Liquid Glass look on the web. Add a data attribute to any element and it gets a blurred backdrop, a lens-like distortion along its edges and a soft glow just inside the rim. It has no dependencies, weighs about 6 KB gzipped and works with any framework, or none at all.

The idea

The idea started on this very website: I built the glass effect for its own interface, then turned it into a standalone library, with no tie to any framework, so that any site can use it. You start it once, and every element with a data-liquid-glass attribute becomes glass. The library follows the page, picking up elements as they are added, moved or removed, and when their attributes change, so it works the same with plain HTML, a CMS or any framework.

How it works

The distortion comes from a displacement map built for each element from its own size and corner radius, so a pill, a card and a circle all bend differently at the edges. It is applied through an SVG filter inside backdrop-filter. Filters are shared between elements of the same size, and sizes are rounded, so animating a width doesn’t create a new filter on every frame. The glow is a stack of uniform bands that follows the outline evenly, because a plain blurred shadow comes out brighter at the corners.

Browser support

The distortion only works in Chromium browsers. Other engines accept the filter but don’t draw it, and lose the blur along with it, so the library detects that and falls back to the plain blur and brightness. The glass still looks like glass, just without the lens effect.

Open source

Liquid Glass is published on npm and available on GitHub under the MIT licence. Its documentation site has a live playground, where you can drag the glass around, change every setting and copy the resulting snippet, along with examples such as cards, buttons and a floating navigation bar, and setup guides for React, Vue, Svelte and Angular.

Zen mode
Theme
Language
Mute sound
© 2026 Gabriel Figueredo
Open controls