shadcn Glassmorphism: Three Ways to Get a Glass UI
shadcn glassmorphism in three ways: restyle the stock Card, Dialog and Button, retheme the CSS variables, or install glass components with the shadcn CLI.
By Lokendra Singh Rathore (GitHub, opens in a new tab)About the authorPublished 9 min read




shadcn glassmorphism is a frosted-glass look (a translucent fill, a backdrop-filter blur and a light border) applied to shadcn/ui components. shadcn/ui has no glass theme of its own, so you get there in one of three ways: add Tailwind classes to the components you already have, change the shadcn theme variables so every component turns translucent, or install components that were built as glass from the start.
SheenUI is our own library, and it is the third way; the first two need nothing from us. For a library comparison instead of a how-to, read shadcn alternatives and best glassmorphism React libraries.
Short answer, by effort:
- Restyle a few components: add
backdrop-blur-xl, a translucent fill and a light ring to a Card, a Dialog and a Button throughclassName. - Change the theme: make
--card,--popoverand--bordertranslucent in your CSS and add one blur rule, so every stock component follows. - Install glass components:
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/glass-card.json, which brings the tokens, the glass levels and the fallbacks with it.
Basis: the shadcn/ui documentation, its component registry and the npm registry, read on 26 Nov 2026 as the text says. Browser behavior and numbers come from our other guides, which cite MDN and our own measurements. First published 26 Nov 2026, last revised 26 Nov 2026; shadcn/ui changes often, so check the version you install.
What you start from in a shadcn/ui project
Four facts about the stock setup decide how the glass is built, all read from the shadcn docs on 26 Nov 2026:
- Colors are CSS variables. The theming page (opens in a new tab) lists token pairs such as
background,card,popover,primary,muted,accent,border,inputandring, each surface token paired with a-foregroundtext token. Defaults are written inoklch(), defined under:rootand.dark, and exposed to Tailwind through@theme inline. - Tailwind v4 is the default for new projects. The Tailwind v4 page (opens in a new tab) says "Only new projects start with Tailwind v4 and React 19"; older projects keep working on v3.
- Every part carries a
data-slotattribute, such asdata-slot="card", which plain CSS can select. - New projects use Base UI. The July 2026 changelog entry "Base UI as the Default" says "New projects now use Base UI by default. Radix is still fully supported." The Dialog page (opens in a new tab) opens on a Base UI tab. The
shadcnCLI package was at 4.23.1 on npm that day.
The code below follows the Base UI version of the component source (the base-nova style); the className overrides work the same on the Radix version.
Way 1: restyle the stock components with Tailwind utilities
This is the fastest route and touches only the components you choose. Every shadcn/ui component merges your className over its own classes, so the glass classes win.
A glass Card
The stock Card is bg-card with a ring-1 outline and no blur. Put it over something colorful, give it a translucent fill, a blur and a light ring:
bg-card/55 works because Tailwind v4 mixes the opacity into the --card token. backdrop-saturate-150 brings back some of the color that the blur washes out. Blur over a flat color shows nothing, so put a gradient or an image behind the card.
A glass Dialog
The stock Dialog has an overlay (dimmed, with a light backdrop-blur-xs in the source we read) and a content panel. The panel takes className directly:
DialogTrigger render={...} is the Base UI form; on the Radix version use asChild.
The overlay is rendered inside DialogContent, so a className cannot reach it. Because shadcn copies the file into your repo, edit it there. The stock line is bg-black/10 supports-backdrop-filter:backdrop-blur-xs; make the dim stronger and the blur a little larger, so the panel has something calm to sit on:
On Radix, the same edit goes on DialogOverlay. The stock footer has bg-muted/50, so we reset it to keep the panel one surface.
A glass Button
The outline variant is the best base because it already has a border. A thin wrapper keeps the classes in one place:
Keep filled primary buttons opaque: a translucent primary button over a busy backdrop is the quickest way to fail contrast.
Way 2: a glass theme through CSS variables
If most of your app should be glass, change the tokens once. Every stock component reads --card, --popover and --border, so alpha on those variables turns them all translucent without touching a component. Add this to the CSS file where shadcn defined its tokens (names are shadcn's, values are ours to tune):
Four things set the look: fill alpha, a border lighter than the fill, the blur radius and the shadow. Dark mode needs its own values. The @layer components rule sits below Tailwind's utilities, so a one-off backdrop-blur-none on a single card still wins. Put a gradient or image on body, or there is nothing to blur.
Where Way 2 stops working:
- Popovers over busy backdrops. Menus and comboboxes show many short lines of text over whatever is behind them. Keep
--popovermore opaque than--card, as above, or make it solid. - Nested blur. An element with
backdrop-filterbecomes a backdrop root, so a blurred child inside a blurred parent can only blur the parent's own fill, not the page behind. A Card inside a Card, or a sticky header inside a glass panel, gets a second blur that shows nothing and still costs GPU time. Blur the outer surface only. - Borders and inputs.
--borderis used for every divider, and--inputfor field outlines. A near-white border on a light page disappears, and field outlines are UI component boundaries that WCAG 1.4.11 asks to reach 3:1 contrast. Leave--inputsolid. - Everything else that reads the tokens. Charts, tables and sidebars change too; check each.
Way 3: install ready glass components with the shadcn CLI
SheenUI is our own library: glass components built on Base UI, Tailwind CSS v4 and Motion, MIT licensed. The @sheenui/theme package is not on npm; it is private on purpose, so you install through the shadcn registry, which copies the source into your repo like any shadcn component.
The CLI documents add as taking a "name, url or local path to component" (CLI docs (opens in a new tab)), so a registry item is just a URL:
Real item names in the registry include glass-card, button, dialog, popover, navbar, liquid-glass (the refraction effect) and sheenui-theme, the shared base that every other item depends on (tokens, glass levels, motion, hooks and styles). Each item installs into components/sheenui/<item>/. There are also five install bundles that have no files of their own and only pull in existing items: components, charts, blocks, dashboards and all.
Using them looks like this. Imports follow the copied-files layout, and glass is a button variant:
What you get that Ways 1 and 2 leave to you: three glass levels (1 for chips, 2 for cards, 3 for dialogs and bars), a Liquid Glass refraction effect in Chromium with a frosted fallback in Safari and Firefox, glass that turns solid under reduced transparency, more contrast and forced colors, and a cap of at most 8 blurred surfaces and 3 refraction lenses in view. The cost: a second component set next to shadcn/ui, a provider to mount once, and a CSS import the CLI appends (Next.js needs a relative path). The install guide has the tested steps, and the installation page lists every item. Live examples: Glass Card, Dialog, Button and the Liquid Glass effect.
Rules that keep glass usable
These apply to all three ways.
- Check text contrast at the worst backdrop point. WCAG asks for 4.5:1 for normal text and 3:1 for large text. On glass the background differs at every pixel, so measure the lightest and darkest spots behind the text, not the CSS color. The method is in accessible glassmorphism. If it fails, raise the fill opacity before you touch the text color.
- Ship a solid fallback. Glass should become a solid surface for
prefers-reduced-transparency,prefers-contrast: moreandforced-colors. Chrome and Edge support the first from version 118, Firefox only behind a flag and Safari not at all, so also offer an in-app switch. One unlayered block covers Ways 1 and 2, becausedata-slotmarks every shadcn part and unlayered CSS beats Tailwind's layered utilities:
- Keep a blur budget. Cost grows with the area blurred and with how often the backdrop changes. In our measurement, 8 full-viewport blurred layers over a moving backdrop ran at 44 to 50 fps on an M1, 16 at 22 to 26 and 32 at 12 to 13, while the same layers over a static backdrop held 60. Twenty-four panels of 400 by 300 held 60. These are one machine's numbers; the performance guide has the setup and limits. SheenUI caps itself at 8 blurred surfaces in view.
- Do not fade a wrapper that contains glass. An ancestor with
opacitybelow 1, afilter, amaskor aclip-pathbecomes a backdrop root and the blur stops there. Animate the glass element itself. This bites with shadcn's fade-in animations if you put them on a parent of a glass Card. - Check focus rings. Rings made from
box-shadowvanish in forced colors, so check shadcn'sringutilities in Windows High Contrast.
Which way to pick
Other shadcn-compatible glass libraries
SheenUI is not the only registry that installs glass through the shadcn CLI. liqui.design, Glassy UI and crenspire Glass UI each publish glass items, and they differ in primitives (Base UI or Radix), refraction support and how they handle Safari. We compare them on checked data, with licenses, install commands and fallbacks, in best glassmorphism React libraries. The broader list of shadcn alternatives is in shadcn alternatives. For the build-it-yourself version, see the glassmorphism React tutorial.