Glassmorphism in React: A Step-by-Step Tutorial
Glassmorphism in React is a frosted-glass UI style: a tint, backdrop-filter blur and light border. Build it in CSS, Tailwind v4 and React, with contrast.
By Lokendra Singh Rathore (GitHub, opens in a new tab)About the authorPublished Updated 7 min read




Glassmorphism in React is a UI style where a component looks like frosted glass: a translucent tint, a backdrop-filter blur and a thin light border over a colorful background. This tutorial builds it from four layers in plain CSS, then Tailwind CSS v4, then a typed React component, with contrast checks and fallbacks for people who turn transparency off.
SheenUI is our library, so we use it at the end. Everything before that section needs only React, Tailwind and, for the last animation, motion. If you want ready-made parts instead of a tutorial, start from the glassmorphism React components home page. Each step is a short glassmorphism React example you can paste into a project and see working before you read on. To see the finished surface live, open the Glass card page.
Quick answer, the smallest glassmorphism in React or any page (a colorful background behind it makes it visible):
Basis: written for React 19.2+ and Tailwind CSS v4; the Tailwind statement about variants refers to Tailwind CSS 4.3.5, and browser support is quoted from MDN browser-compat-data. First published 8 Nov 2026, last revised 26 Nov 2026.
What glassmorphism is
Glassmorphism is a surface that looks like frosted glass: you see a blurred version of whatever sits behind it. It is not a color or a shadow. It only works when there is something colorful behind the glass, which is why flat white pages make it look like a gray box.
Nielsen Norman Group describes the style and its risk in one line: if overused, it can pose significant accessibility and usability challenges (opens in a new tab). Keep that in mind; sections 4 and 5 are about it.
The four layers
Build the effect in this order. Each layer fixes a specific problem of the one before.
- A vivid background. Without color variation there is nothing to blur. A gradient or a few soft blobs is enough.
- A tint. A semi-transparent fill (white in light mode, a dark smoke in dark mode) lowers the contrast of whatever shows through, so text on top stays readable.
- A backdrop blur.
backdrop-filter: blur()blurs what is behind the element, not the element itself. A smallsaturate()brings back the color the blur washes out. - A lit border. A 1px light border and a thin inner highlight on the top edge make the pane read as a physical sheet.
In plain CSS:
backdrop-filter is supported unprefixed in Chrome 76, Edge 79, Firefox 103 and Safari 18, with a -webkit- prefix back to Safari 9 (MDN browser-compat-data 8.1.8, 2 Nov 2026 (opens in a new tab)). Keep the prefixed line for older Safari.
The same four layers as Tailwind CSS v4 utilities (SheenUI's Tailwind CSS v4 setup shows the imports it needs). In v4, backdrop-blur-xl is a 24px blur:
A reusable GlassCard in TypeScript
Three levels cover most interfaces: level 1 for small chips, level 2 for cards, level 3 for dialogs and bars. Higher levels use more tint and more blur. This component has no dependencies except React:
Because it spreads ComponentProps<"div">, it accepts onClick, aria-* and ref like a normal div.
One rule saves hours of debugging: never fade or filter a wrapper of a glass element. An ancestor with opacity below 1, a filter, a mask, a clip-path or a mix-blend-mode becomes a "backdrop root", and the blur then only sees content inside that ancestor, not the page behind it (MDN (opens in a new tab)). Animate the glass element itself.
Keeping text readable
The tint is not decoration; it is what keeps text legible. WCAG 2 asks for 4.5:1 contrast for normal text and 3:1 for large text (opens in a new tab), and on glass the background behind the text is different at every point.
So test the worst case, not the average. Composite your tint over the brightest and darkest parts of your backdrop and keep the minimum:
Run it with text #1b1b2f and a white tint at 55% opacity. In our run (computed with the code above), that text scored 7.98:1 over a pure #e11d48 red, 13.29:1 over #fbbf24 amber and 5.02:1 over pure black. The darkest sample is the limit here. Without the tint the same red gives only 3.59:1 and black 1.24:1, which is why the tint matters. If your worst sample falls under 4.5, raise the tint opacity, change the text color, or move the text off that part of the background.
SheenUI's own tokens file records the same kind of measurement. On its brightest backdrop blob, muted text measured 5.2:1 (light theme) bare and 6.7:1 on level-2 glass, because the tint lifts it. Numbers like these come from sampling rendered pixels, not from guessing; the accessibility guide shows how.
Fallbacks for people who turn transparency off
Some people cannot read through translucency. Operating systems expose that as media queries, and glass should answer each of them by becoming a solid surface:
Browser support differs. prefers-reduced-transparency is in Chrome and Edge 118, behind a flag in Firefox 113 and absent from Safari, and MDN still marks it experimental. prefers-contrast is supported from Chrome 96, Firefox 101 and Safari 14.1, and forced-colors from Chrome 89, Firefox 89 and Safari 16 (MDN browser-compat-data (opens in a new tab)). Because Safari has no transparency query, also offer an in-app toggle that sets a data-transparency="reduced" attribute and mirror the same rules under it.
In Tailwind, contrast-more: and forced-colors: are built-in variants, but Tailwind 4.3.5 has none for reduced transparency, so define one once:
Performance in one paragraph
Each blurred surface costs a render pass, and the cost grows with its area and blur radius. SheenUI's budget is at most 8 blurred surfaces in view, a 20px blur on level-2 glass and 32px on level 3, and no blur at all on tiny level-1 chips, which only use tint. For the reasons and how to measure on your own pages, read the backdrop-filter performance guide.
Adding Motion: a pointer sheen, springs and reduced motion
A soft highlight that follows the pointer sells the glass. With motion, the pointer position lives in motion values, so moving the mouse never re-renders React:
useReducedMotion reports the operating system setting, so the lift and the sheen turn off for people who asked for less motion. Touch is skipped because a finger dragging across the card is scrolling, not hovering.
Copy-paste glass components: card, navbar, login, dashboard
Writing every piece yourself gets long. If your project is already on shadcn/ui, shadcn glassmorphism applies these layers to its Card, Dialog and Button. SheenUI is a copy-the-source library (the @sheenui/theme package is not on npm yet, so you add components with npx shadcn@latest add or copy the folders you need; the README, the install guide and the installation page list the steps). It adds the lit rim, three glass levels, the fallbacks above and the preference hooks. A card and a floating navbar with a button:
A complete glass login form is one component, and the web analytics dashboard shows how many glass panels one page can carry. The foundations page documents the Tailwind tokens behind all of it.
When not to use glassmorphism
- Dense data and long reading. Tables, forms with many fields and body text are better on solid surfaces. Use glass for the frame around them.
- Flat or white backgrounds. There is nothing to blur, so you get a pale gray box with a cost.
- Low-end devices and many panels. A page full of blurred cards drops frames on weak GPUs. Use fewer, larger panels.
- Text on small, busy areas. If you cannot guarantee 4.5:1 over the worst backdrop point, use a solid surface.
- Brand or product rules that need exact color. Translucency changes color depending on what is behind it.