Liquid Glass UI for React
A Liquid Glass effect for React in the style of Apple's iOS 26 design: a lens that refracts the page behind it through an SVG displacement map, with a specular rim.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/liquid-glass.jsonLiquidGlasssupportsLiquidGlassMAX_REFRACTION_SURFACES- +1 more
In this browser:Frosted fallback
Drag the lens
A clear circle lens over crisp artwork. Drag it (or focus it and use the arrow keys) and watch the lines bend and split into color at the rim.
import { useRef, type KeyboardEvent } from "react";
import { LiquidGlass } from "@/components/sheenui/liquid-glass/liquid-glass";
// Package build (after the first npm release, or a packed tarball): import { LiquidGlass } from "@sheenui/theme";
import { motion, useMotionValue } from "motion/react";
const moves: Partial<Record<string, [number, number]>> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] };
// Written out here on purpose: the library's clamp is internal, and this example has to run on its own.
const clamp = (v: number, min: number, max: number) => Math.max(min, Math.min(max, v));
export function Example() {
const areaRef = useRef<HTMLDivElement>(null);
const x = useMotionValue(0);
const y = useMotionValue(0);
// Arrow keys move the lens (Shift for bigger steps), kept inside the artwork.
function nudge(event: KeyboardEvent<HTMLDivElement>) {
const move = moves[event.key];
const area = areaRef.current;
if (!move || !area) return;
event.preventDefault();
const lens = event.currentTarget;
const step = event.shiftKey ? 64 : 16;
x.set(clamp(x.get() + move[0] * step, -lens.offsetLeft, area.clientWidth - lens.offsetLeft - lens.offsetWidth));
y.set(clamp(y.get() + move[1] * step, -lens.offsetTop, area.clientHeight - lens.offsetTop - lens.offsetHeight));
}
return (
<div ref={areaRef} className="relative h-96 overflow-hidden rounded-sheen-xl bg-gradient-to-br from-fuchsia-500 via-violet-500 to-sky-400">
<LiquidGlass
shape="circle"
variant="clear"
aberration={0.6}
render={
<motion.div
drag
dragConstraints={areaRef}
dragElastic={0.12}
whileDrag={{ scale: 1.06 }}
style={{ x, y }}
/>
}
tabIndex={0}
role="group"
aria-roledescription="movable lens"
aria-label="Lens. Drag it, or use the arrow keys to move it."
onKeyDown={nudge}
className="absolute top-1/2 left-1/2 -mt-20 -ml-20 size-40 cursor-grab touch-none"
/>
</div>
);
}Files to copy
4 folders · 4 files · 3 packages
- From
theme/src/ components/liquid-glass/hooks/{use-intersection.ts, use-media-query.ts, use-preferences.ts}lib/cn.tsstyles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/liquid-glass.jsonRegistry item: liquid-glass. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add @base-ui/react clsx tailwind-merge
Floating tab bar
A pill of regular liquid glass over scrolling content, the way iOS 26 floats its tab bars. Its tint thins out towards the rim, so the tiles visibly bend at the edge while the labels keep a solid backplate.
import { useState } from "react";
import { LiquidGlass } from "@/components/sheenui/liquid-glass/liquid-glass";
// Package build (after the first npm release, or a packed tarball): import { LiquidGlass } from "@sheenui/theme";
const tabs = [
{ id: "all", label: "All", icon: null },
{ id: "albums", label: "Albums", icon: null },
{ id: "shared", label: "Shared", icon: null },
];
export function Example() {
const [active, setActive] = useState("all");
return (
<div className="relative h-[26rem] overflow-hidden">
<div role="region" aria-label="Photo library" tabIndex={0} className="h-full overflow-y-auto p-3 pb-28">
{/* tiles */}
</div>
<LiquidGlass
shape="pill"
render={<nav aria-label="Library sections" />}
className="absolute inset-x-3 bottom-3 mx-auto flex max-w-md justify-between gap-1 p-1.5"
>
{tabs.map((tab) => (
<button
key={tab.id}
type="button"
aria-current={active === tab.id ? "page" : undefined}
onClick={() => setActive(tab.id)}
className="flex min-h-12 flex-1 flex-col items-center justify-center rounded-sheen-full text-2xs font-semibold aria-[current=page]:text-sheen-accent"
>
{tab.icon}
<span className="truncate">{tab.label}</span>
</button>
))}
</LiquidGlass>
</div>
);
}Shapes and variants
Pill, circle and rounded rectangle, each with its own displacement map. Interactive glass grows a touch on hover and presses in on tap: only its scale ever animates.
Now playing
Glass Animals · Heat Waves
import { LiquidGlass } from "@/components/sheenui/liquid-glass/liquid-glass";
// Package build (after the first npm release, or a packed tarball): import { LiquidGlass } from "@sheenui/theme";
import { Play as PlayIcon } from "lucide-react";
export function Example() {
return (
<>
<LiquidGlass shape="pill" interactive render={<button type="button" />} className="h-12 px-6 text-sm font-semibold">
Get started
</LiquidGlass>
<LiquidGlass
shape="circle"
interactive
render={<button type="button" aria-label="Play" />}
className="grid size-14 place-items-center [&>svg]:size-6"
>
<PlayIcon />
</LiquidGlass>
<LiquidGlass className="flex w-full max-w-72 flex-col gap-1 p-5">
<p className="font-semibold">Now playing</p>
<p className="text-sm text-sheen-fg-muted">Glass Animals · Heat Waves</p>
</LiquidGlass>
</>
);
}Props
Keyboard
Accessibility
- Pure decoration around your content: text on a regular lens keeps 4.5:1 contrast on any backdrop, and the rim is decorative.
- The lens is Chromium only: Safari and Firefox keep the frosted blur. Reduced transparency, more contrast and forced colors give a solid surface; forced colors drop the rim.
- A draggable lens needs a keyboard alternative: the example moves with the arrow keys (Shift for bigger steps).
All exports on this page
LiquidGlass— Liquid glass: a lens that bends the page behind it, like Apple's Liquid Glass.MAX_REFRACTION_SURFACES— Refraction budget: SVG refraction on at most MAX_REFRACTION_SURFACES lenses at once, page-wide.supportsLiquidGlass— Whether this browser renders SVG filters in backdrop-filter (backdrop-filter: url(#id)).
When to use the liquid glass effect
- Use it as a liquid glass effect for a few hero surfaces that sit over photos or video, such as a floating media control, a caption overlay or a navigation pill that visibly bends the page behind it in Chromium.
- Use shape="pill" for a floating action bar and shape="circle" for a round play button, with variant="clear" when the content is only an icon or a bold label over imagery.
- Add interactive when the lens is a control, so it grows slightly on hover and presses in on tap, and give it role, tabIndex and handlers yourself.
- Skip it when you have more than a handful of surfaces or ordinary cards: refraction is limited to three lenses per page, so GlassCard is the right tool for lists, grids and panels.
- Pair it with Button for the action inside the lens, GlassCard for everything else on the page, and the supportsLiquidGlass helper when you want to adjust copy or layout by engine.
Frequently asked questions
Related pages
Guides that cover it
- Apple Liquid Glass in CSS and React
- Accessible Glassmorphism
- Glassmorphism vs Liquid Glass vs Neumorphism
- backdrop-filter Performance: Fast Glassmorphism
- Best Glassmorphism React Libraries (2026)
- shadcn Alternatives with Animation: Nine Libraries Compared (2026)
- Glassmorphism UI Prompts for AI Coding Agents
19 effects pages in all: browse them on All effects.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .