Glass Tilt Card
betaA frosted glass card that tilts in 3D toward the pointer with a glare that follows it, and sways gently at rest.
- Display
- 1 file
- No extra npm packages
- Accessibility notes
Loading the example…
pnpm dlx @dowel-ui/cli add glass-tilt-cardNo npm packages are needed beyond what Dowel already requires.
import { GlassTiltCard } from "@/components/ui/glass-tilt-card";Default
Demo
Over Colour
Disabled
<GlassTiltCard>
| Prop | Type | Default |
|---|---|---|
disabledKeeps the card still. | boolean | false |
glareA highlight that follows the pointer across the glass. | boolean | true |
maxTiltThe largest tilt, in degrees, with the pointer at an edge. | number | 14 |
perspectiveDistance of the viewer from the card, in pixels. Smaller is more dramatic. | number | 700 |
surfaceClassNameClasses for the glass surface itself (the root only positions it). | string | — |
swayThe slow idle lean while the pointer is elsewhere. | boolean | true |
swayDurationOne idle sway cycle, in milliseconds. Scaled by --motion-scale. | number | 6000 |
Plus every attribute of <div>.
Decoration on a plain container: it adds no role, name or tab stop, so a card that acts as a link should contain a real link or button. The sheen, glint and glare layers are aria-hidden and ignore the pointer, so they never intercept clicks. The tilt never runs for touch, coarse pointers or under prefers-reduced-motion, and the idle sway settles flat under reduced motion. Text on the glass should keep contrast against whatever sits behind it; the surface is translucent.
8/8
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes