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 change Improved v2.3.5 Card's edge is retuned. Light glass loses its line: the 0.5 px black hairline at 8% is gone, and the shadow alone sets the card off the page. Dark glass draws a brighter one, white at 45% and about 1 px wide in place of 8% at 0.5 px, with a faint dark outline on its very edge. The tint, the frost and the shadow are as they were. optics.borderAlpha sets your own line, on both.
  1. v2.3.5 Improved Card's edge is retuned. Light glass loses its line: the 0.5 px black hairline at 8% is gone, and the shadow alone sets the card off the page. Dark glass draws a brighter one, white at 45% and about 1 px wide in place of 8% at 0.5 px, with a faint dark outline on its very edge. The tint, the frost and the shadow are as they were. optics.borderAlpha sets your own line, on both.
  2. v2.3.0 Improved A glass whose corners differ keeps each its own. The glass took the top left corner for all four; now rounded-t-3xl on a Card, or any radius set corner by corner, is drawn as it is written.
  3. v2.3.0 Improved Card's glass is whiter on a light page: its tint covers 85% in place of 60%, so what is on the card reads over any colour behind it. The dark card keeps its 62% grey, and a tint of yours still applies to both.
  4. v2.2.1 Improved Card has a new default glass, tuned in the lab beside Glisse's (MIT). The tint is lighter: 60% white on a light page and 62% of a dark grey (rgb(40 40 40)) on a dark one, in place of 70% white and black. The frost is 3 px in place of 5, what shows through is 1.5 times as vivid, and the rim's bend stays close to the edge instead of reaching half way in. The 1.3 px white line gives way to a 0.5 px hairline at 8%, black on light glass and white on dark. tint and blur still set your own, and a tint of yours applies to both themes.
  5. v2.2.1 Improved GlassOptics has a third way to bend, bendMode: 'bezel': straight in from the rim, as light bends through a rounded bezel, by Glisse's own formula (github.com/0kzh/glisse, MIT). bendDepth is then the bevel's width as a share of half the glass, refraction how far it bends, and zoom and rimShine come with it; a bevel as wide as half the glass makes a lens. No component uses it by default. optics.dark.tintColor gives dark glass a tint colour of its own.
  6. v2.0.4 Improved In the Card example the rows of colour run from one side of the stage to the other, with no padding at the sides, and fade in at both ends through an SVG mask instead of a progressive blur.
  7. All changes→
glass-card-basic.svelte

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-svelte@latest add https://liquidglass.pulse.city/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 (0.85), a dark grey on a dark one (0.62). Yours applies to both.

number0.85 / 0.62
blur

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

number3
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.

Liquid Glass Svelte is open source and MIT licensed. If it saves you time, you can support the project.