Web · Components
Card
A card grouping content.
Live example
Preview
Create account
Card content goes here.
Effects (hover over them)
Lift
Hover or Tab into it.
Border color
Hover or Tab into it.
Spinning light
Hover or Tab into it.
Pointer light
Hover or Tab into it.
3D tilt
Hover or Tab into it.
Shine
Hover or Tab into it.
Tilt + light
Like a platform, the side the pointer presses goes down.
Selected plan
Always on, even without a mouse.
Custom color
Accent color via a CSS variable.
Appearances
outline
Content
elevated
Content
filled
Content
ghost
Content
gradient
Content
glass
Content
dashed
Content
Code
Events
- Events appear here when you interact with the preview.
Import
A card grouping content. Title, description, icon, action and footer are given with props; children goes into the content area. A server component.
Examples
CardVariant
typeCard appearance.
outline: border and a light shadow (default).elevated: no border, a pronounced shadow; it stands raised from the background.filled: muted background, no border or shadow.ghost: no background, border or shadow; only layout and effects.gradient: a background with a light gradient flowing from the accent color.glass: semi-transparent frosted glass that blurs what's behind it.dashed: dashed border; for empty-state and "add new" cards.
CardEffect
typeCard effect. Active on hover, on keyboard focus of an element inside, or when active is given. Several effects can be combined as an array (e.g. ["tilt", "glow"]).
lift: the card rises slightly and its shadow grows.border: the border turns the accent color at once.beam: a light beam rotating around the border.glow: a light following the pointer; the background and border glow where the pointer is.tilt: the card tilts in 3D toward the pointer's corner; like a platform being stood on, the side the pointer presses goes down.shine: a diagonal shine passes over the card on hover.
Press effects (ripple, pulse, bounce, scale) and custom effects added with defineAppearance can also be given; see BuiltinEffect for the full list.
glow and tilt work only on mouse devices; on touch screens the card stays still so it doesn't interfere with scrolling. With "reduce motion" on, tilt, lift and the rotating beam turn off; instead of the beam the border takes the accent color.
CardClassNames
interfaceClasses that can be given to the inner parts of Card.
| Name | Type | Description |
|---|---|---|
header? | string | Top area holding the title, description, icon and action. |
icon? | string | Icon box. |
title? | string | Title. |
description? | string | Description. |
content? | string | Content area wrapping children. |
footer? | string | Footer area. |
CardProps
interfaceProps of the Card component.
Extends: Omit<ComponentProps<"div">, "title">
| Name | Type | Default | Description |
|---|---|---|---|
title? | ReactNode | Card title. | |
description? | ReactNode | Description below the title. | |
icon? | IconProp | Icon left of the title: a name ("chart") or an element. | |
action? | ReactNode | Action at the top right corner (e.g. a menu or a button). | |
footer? | ReactNode | Area at the bottom of the card; usually buttons. | |
titleAs? | "h2" | "h3" | "h4" | "div" | "h3" | HTML element of the title. Change it to fit the page's heading order. |
classNames? | CardClassNames | Classes added to the inner parts. | |
variant? | CardVariant | CustomVariant<"card"> | "outline" | Appearance: border, background and shadow. Custom appearances added with defineAppearance can also be given. Defaults to UIProvider appearance.defaults.card.variant. |
tone? | Tone | "primary" | Accent color of the effects and the gradient appearance. For another color pass style={{ "--ui-card-accent": "#7c3aed" }}. |
effect? | CardEffect | Effect or effects (e.g. ["tilt", "glow"]). Defaults to UIProvider appearance.defaults.card.effect. See CardEffect. | |
active? | boolean | Keeps the effects on regardless of the pointer: the border stays highlighted, the beam rotates, the card stays raised. Useful for showing the selected card (e.g. choosing a pricing plan). |