Skip to content

Components

Card

A card made of frosted glass. Your content sits on it; its face blurs and tints whatever lies behind so the text stays readable, and its rim pulls it towards the centre.

Latest changeFixedv1.5.5The first example shows one card where two do not fit side by side, centred on the two rows of colour. On a phone the cards used to stack, and the rows ran through the gap between them.
  1. v1.5.5FixedThe first example shows one card where two do not fit side by side, centred on the two rows of colour. On a phone the cards used to stack, and the rows ran through the gap between them.
  2. v1.3.4ImprovedA new example in place of the notification: an activity ring, a battery list and a now-playing card over a still wallpaper of plain CSS. It scales down to fit a phone.
  3. v1.2.2FixedCard's drop shadow is two soft layers (16.5 px and 26.4 px down, 8% black each), the same at every card size.
  4. v1.2.2ImprovedIn the example, the rows of colour blur progressively as they reach either end, and the shadow is no longer cut off.
  5. v1.2.0ImprovedCard's glass is the first card's again: the rim pulls what is behind towards the centre, deep and wide, and a 5 px frost blurs the bent picture, under a 70% tint (white on a light page, black on a dark one) and a 1.3 px white line. It is drawn by the WebGL glass, so it now looks the same in Safari, Firefox and on phones. Your tint, blur and optics still override it.
  6. v1.1.3ImprovedCard has a new default glass: a lighter 3.5 px frost with more vivid colour, a 68% white tint on light pages and 79% black on dark ones, a hairline of white at the rim, and a tighter bend with a slight colour split. The face carries no light or shadow. Your tint, blur and optics still override it.
  7. All changes →
glass-card-basic.tsx

Use it for

  • A small surface of content over colour, imagery or motion: a widget, a now-playing card, a summary.
  • One or two cards, where what is behind them is part of the design.

Not for

  • Long text and forms: the backdrop shows through. Use a plain card.
  • A card on a flat background: there is nothing to bend.
  • One clickable action: use GlassButton.

Installation

npx shadcn@latest add https://onemorethink.dev/r/card.json

Usage

app.tsx
import { GlassCard } from '@/components/liquid-glass'

<GlassCard className="w-64 p-5">
  <p className="font-semibold">Wednesday</p>
  <p className="text-sm opacity-60">Design review · 10:00</p>
</GlassCard>

// Something moves behind it: repaint what it bends every frame.
<GlassCard live className="size-44 p-4">…</GlassCard>

// Clearer glass: no frost, less tint.
<GlassCard blur={0} tint={0.3} className="w-64 p-5">…</GlassCard>

API reference

PropTypeDefault
children

The card's content.

ReactNode—
material

Clear bends what is behind; tinted uses the background colour.

'clear' | 'tinted''clear'
tint

Clear glass only: how much tint covers the backdrop (0–1): white on a light page, black on a dark one.

number0.7
blur

Clear glass only: how much the backdrop is frosted, in px like CSS blur(). 0 shows it sharp.

number5
live

Repaint the backdrop every frame, for content that moves behind the card.

booleanfalse
className

Size, padding, corners (rounded-*) and, for tinted glass, colour (bg-*).

string—
…rest

Passed to the <div> (role, aria-label, onClick…).

div attributes—

Accessibility

  • A plain <div>: when the card stands for one thing, name it (role="group" with an aria-label).
  • The glass canvas is aria-hidden; only your content is read.
  • Content that moves behind it should respect reduced motion: the rows above stop.