Apple Liquid Glass in CSS and React
Liquid Glass CSS for React: Apple's iOS 26 look with an SVG displacement map, plus a frosted fallback for Safari and Firefox. Working code.
By Lokendra Singh Rathore (GitHub, opens in a new tab)About the authorPublished Updated 7 min read




Liquid Glass CSS is possible on the web, with one big limit: the refraction part works in Chromium only. This guide builds the effect step by step with an SVG displacement map inside backdrop-filter, wraps it in a React component, and shows the frosted-glass fallback that Safari and Firefox get.
SheenUI is our library, so we also show its LiquidGlass component at the end. The live version is on the Liquid glass effect page.
What Liquid Glass is, and how it differs from frosted glass
Apple announced Liquid Glass on 9 June 2025 for iOS 26, iPadOS 26 and macOS Tahoe 26. Apple describes the material as one that reflects and refracts its surroundings (opens in a new tab), with specular highlights that react to movement.
The practical difference from the older frosted style (see our glassmorphism tutorial) is this. Frosted glass only blurs what is behind it. Liquid Glass bends it, like a thick lens: the backdrop is shifted and magnified near the edges, and stays sharp in the middle. On the web we approximate that with a static map, not Apple's real-time rendering, so treat the result as a convincing imitation.
How refraction works on the web
CSS has no "refract" function. The trick is backdrop-filter accepting a reference to an SVG filter, and one SVG primitive, feDisplacementMap (opens in a new tab), which moves pixels according to a second image.
For every output pixel P, the filter reads the input at P + scale × (R − 0.5, G − 0.5), where R and G come from the map image at P. A mid-gray map pixel (128, 128) means no shift. So you draw a map that is gray in the middle of the lens and pushes pixels along the surface normal near the rim. The rim width is called the bezel.
Quick answer
Liquid Glass in CSS is a backdrop-filter that points at an SVG displacement filter. The smallest version:
The #liquid filter is an feGaussianBlur followed by an feDisplacementMap that reads a map image (step 2). It refracts in Chromium only. Safari and Firefox keep the frosted rule, and @supports cannot choose between them, because those engines report url() as supported, so engine detection sets data-refraction (see Browser support). The steps below build the map, the filter, the rim and the React component.
Basis: the refraction was confirmed in Chromium 156; we could not confirm the Safari and Firefox rendering ourselves, and the support data is from MDN browser-compat-data 8.1.8 (2 Nov 2026). First published 8 Nov 2026, last revised 12 Nov 2026.
Step by step
1. The displacement map
This function draws the map on a canvas for a rounded rectangle. It computes each pixel's distance in from the edge and the direction out of the shape, and pushes hardest at the edge, fading to nothing at the inner end of the bezel:
The curve (1 - t) ** 3 is a simple stand-in. SheenUI's own map derives the shift from a squircle profile and Snell's law for glass with an index of 1.5, which looks thicker.
2. The SVG filter and the element
Save the map as an image (or set it from the function above) and reference it from feImage. A light blur first gives the frosted look, then the displacement bends it:
Set color-interpolation-filters="sRGB" so the map's gray is read as 128, not converted to linear light. The map's size must match the element's size. And do not set x, y, width or height on the filter element: SheenUI's source records that Chromium blanks the backdrop when a filter region is set.
3. The CSS, including a specular rim
4. The chromatic edge
Real glass splits colors slightly at a curved edge. Run three displacement passes with slightly different scales, keep one channel from each, and add them back with screen. Keep the split small, around 5%, or the edge shows color fringes and hairlines:
Browser support and feature detection
Blur support comes from MDN browser-compat-data 8.1.8 (opens in a new tab) (2 Nov 2026). For the last column, one developer reports that Safari parses backdrop-filter: url(#f) and renders nothing, so the feature query lies (opens in a new tab). We checked the part that matters for code: CSS.supports("backdrop-filter", "url(#f)") returned true in Playwright's Chromium 156, WebKit 27.2 and Firefox 159. So @supports cannot gate this. We could not confirm the blank rendering ourselves, because those WebKit and Firefox builds did not paint even a plain blur() backdrop in our automated screenshots on a Mac.
That leaves engine detection. Prefer navigator.userAgentData where it exists (Chromium only, per MDN (opens in a new tab)) and fall back to the user agent string, excluding iOS browsers, which use WebKit:
In plain HTML and CSS, call it once at startup and let the stylesheet do the rest:
The React component with its fallback
The component measures itself, draws a map at its own size, and applies the filter only when the engine supports it and the map exists. Otherwise it renders ordinary frosted glass:
This is a starting point, not production code. Drawing a map is per-pixel work, so a real component should cap the map size and throttle redraws while the element resizes. SheenUI caps maps at 240,000 pixels and redraws at most every 120 ms.
Rules that keep it usable
- One hero element, never body text. Refraction distorts what is behind the glass. Use it on a button, a nav pill or a floating control, not on paragraphs.
- Solid when transparency is off. Reduced transparency, more contrast and forced colors should drop the lens for a solid surface. SheenUI's
LiquidGlassdoes this by listening to all three media queries. - Budget the lenses. Each lens runs an SVG filter per frame. SheenUI refracts at most 3 lenses at once; extra ones in view fall back to frosted glass until a slot frees.
- Never animate size. A new size means a new map. SheenUI only animates
scaleon hover and press.
Liquid Glass button, navbar and hero
SheenUI is a copy-the-source library (the @sheenui/theme package is not on npm yet; add it from the shadcn registry or copy the files, see the install guide and the installation page; the Tailwind CSS v4 setup covers the CSS). LiquidGlass does the map drawing, the budget, the specular rim and every fallback above, in Chromium and elsewhere:
The default regular variant carries a tint that keeps text legible. The clear variant is barely tinted: keep text off it, or make it bold and large. For ordinary cards, use the Glass card; for a nav, the navbar; and the button page shows the glass variant.
When not to use Liquid Glass
- Safari, Firefox and iOS browsers. They get frosted glass, not refraction. If the effect is the point of your design, you can't deliver it there.
- Reading surfaces. Refraction and body text fight each other. Use solid or frosted glass.
- Many lenses on one page. The cost is per lens, per frame. Use one or two.
- Backgrounds with no detail. A flat color shows nothing to bend.
- Native apps. This is DOM and SVG. In React Native, the native iOS 26 material is wrapped by libraries such as
@callstack/liquid-glass(opens in a new tab) (version 0.8.2 on npm on 8 Nov 2026); check their platform limits yourself.
Read the accessible glassmorphism guide before shipping, and the performance guide for the costs.