Design tokens
Every color, size and motion value on this site, in light and dark.
On this page
import { Badge } from "@/components/Badge";
import { Card } from "@/components/Card";
import { Stack } from "@/components/Stack";
export function CardExample() {
return (
<Card
heading="Design tokens"
headingLevel={2}
href="/design-system/tokens"
footer={
<Stack as="ul" direction="horizontal" gap="xs" aria-label="Formats">
<Badge as="li">DTCG JSON</Badge>
<Badge as="li">CSS</Badge>
</Stack>
}
>
Every color, size and motion value on this site, in light and dark.
</Card>
);
}
Announced as: “Project notes, heading level 4”
Announced as: “Release notes, heading level 5”
.accentCard {
--component-card-raised-border: var(--color-accent-border);
--component-card-padding: var(--space-inset-md);
}Any native prop not listed here goes to the root element unchanged.
subgrid works only when the Card is a direct child of a Grid. For several footer items, use a horizontal Stack. Glass needs a varied backdrop behind it. On a link card, aria-current goes to its heading link. Media is shown first but comes after the heading in the DOM.
| Prop | Type | Default | Description |
|---|---|---|---|
as | "article" | "section" | "div" | "li" | "article" | The root element. |
heading | ReactNode | — | The card's title. Required when href is set. |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | Fits the card into the page's heading outline. The look comes from headingVariant. |
headingVariant | "display" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "lead" | "body" | "small" | "label" | "code" | "inherit" | "h4" | The heading's Typography look, the same at every heading level, except "inherit" and "code", which keep the plain heading's size for its level. |
variant | "raised" | "outlined" | "flat" | "glass" | "raised" | Surface look, each from its own component tokens. |
footer | ReactNode | — | Bottom part, at the card's bottom edge. |
subgrid | boolean | false | In a Grid, parts line up across the row. |
href | string | — | Makes the heading the card's link, and the whole card clickable. |
newTab | boolean | false | With href: open in a new tab. |
media | ReactNode | — | A picture or preview, full-bleed across the top. After the heading in the DOM. |
| Token | Copy | Description | Aliases | Light | Dark | Preview |
|---|---|---|---|---|---|---|
--component-card-border-width | Card outline width, in every variant. | effect.border.width | 2pxfrom effect.line.2 | 2pxfrom effect.line.2 | ||
--component-card-radius | Card corners. | radius.surface | 4pxfrom radius.4 | 4pxfrom radius.4 | ||
--component-card-padding | Padding inside the card. | space.inset.lg | 1.5remfrom space.6 | 1.5remfrom space.6 | ||
--component-card-gap | Space between the heading, body and footer. | space.stack.sm | 0.5remfrom space.2 | 0.5remfrom space.2 | ||
--component-card-heading-color | Heading text. | color.text.default | #17202bfrom color.gray.900 | #fffffffrom color.gray.0 | ||
--component-card-body-color | Body and footer text. | color.text.muted | #455464from color.gray.700 | #e6ecf3from color.slate.100 | ||
--component-card-media-border | Divider between the media and the rest of the card, in every variant. | color.border.default | #adbac8from color.gray.300 | #63676ffrom color.slate.500 | ||
--component-card-transition-duration | Duration of a link card's hover change (0ms under reduced motion). | motion.duration.fast | 150msfrom motion.time.150Reduced motion: 0ms | 150msfrom motion.time.150 | No preview | |
--component-card-transition-easing | Easing of a link card's hover change. | motion.easing.standard | cubic-bezier(0.4, 0, 0.2, 1)from motion.curve.in-out | cubic-bezier(0.4, 0, 0.2, 1)from motion.curve.in-out | No preview | |
--component-card-raised-background | Raised card (the default) surface. | color.surface.raised | #fffffffrom color.gray.0 | #18202efrom color.slate.900 | ||
--component-card-raised-border | Raised card (the default) outline. | color.border.subtle | #e5dccbfrom color.sand.200 | #272f3ffrom color.slate.800 | ||
--component-card-raised-elevation | Raised card (the default) shadow. | effect.elevation.raised | 0px 1px 2px 0px rgb(0% 0% 0% / 0.08)from effect.shadow.sm | 0px 1px 2px 0px rgb(0% 0% 0% / 0.3)from effect.shadow.sm-dark | ||
--component-card-raised-background-hover | Raised card (the default) surface while its link is hovered. | color.surface.sunken | #f2ede2from color.sand.100 | #060a13from color.slate.1000 | ||
--component-card-raised-border-hover | Raised card (the default) outline while its link is hovered. | color.border.strong | #6d7e90from color.gray.500 | #818b9efrom color.slate.400 | ||
--component-card-outlined-background | Outlined card surface. | color.fill.none | rgba(0, 0, 0, 0)from color.overlay.transparent | rgba(0, 0, 0, 0)from color.overlay.transparent | ||
--component-card-outlined-border | Outlined card outline. | color.border.strong | #6d7e90from color.gray.500 | #818b9efrom color.slate.400 | ||
--component-card-outlined-elevation | Outlined card shadow. | effect.elevation.none | 0px 0px 0px 0px rgb(0% 0% 0% / 0)from effect.shadow.none | 0px 0px 0px 0px rgb(0% 0% 0% / 0)from effect.shadow.none | ||
--component-card-outlined-background-hover | Outlined card surface while its link is hovered. | color.surface.sunken | #f2ede2from color.sand.100 | #060a13from color.slate.1000 | ||
--component-card-outlined-border-hover | Outlined card outline while its link is hovered. | color.border.strong | #6d7e90from color.gray.500 | #818b9efrom color.slate.400 | ||
--component-card-flat-background | Flat card surface. | color.surface.sunken | #f2ede2from color.sand.100 | #060a13from color.slate.1000 | ||
--component-card-flat-border | Flat card outline. | color.fill.none | rgba(0, 0, 0, 0)from color.overlay.transparent | rgba(0, 0, 0, 0)from color.overlay.transparent | ||
--component-card-flat-elevation | Flat card shadow. | effect.elevation.none | 0px 0px 0px 0px rgb(0% 0% 0% / 0)from effect.shadow.none | 0px 0px 0px 0px rgb(0% 0% 0% / 0)from effect.shadow.none | ||
--component-card-flat-background-hover | Flat card surface while its link is hovered. | color.surface.sunken | #f2ede2from color.sand.100 | #060a13from color.slate.1000 | ||
--component-card-flat-border-hover | Flat card outline while its link is hovered. | color.border.strong | #6d7e90from color.gray.500 | #818b9efrom color.slate.400 | ||
--component-card-glass-background | Glass card surface. | color.surface.glass-sheer | rgba(255, 255, 255, 0.2)from color.overlay.white-20 | rgba(255, 255, 255, 0.08)from color.overlay.white-8 | ||
--component-card-glass-border | Glass card outline. | color.border.subtle | #e5dccbfrom color.sand.200 | #272f3ffrom color.slate.800 | ||
--component-card-glass-elevation | Glass card shadow. | effect.elevation.raised | 0px 1px 2px 0px rgb(0% 0% 0% / 0.08)from effect.shadow.sm | 0px 1px 2px 0px rgb(0% 0% 0% / 0.3)from effect.shadow.sm-dark | ||
--component-card-glass-background-hover | Glass card surface while its link is hovered. | color.surface.glass-sheer | rgba(255, 255, 255, 0.2)from color.overlay.white-20 | rgba(255, 255, 255, 0.08)from color.overlay.white-8 | ||
--component-card-glass-border-hover | Glass card outline while its link is hovered. | color.border.strong | #6d7e90from color.gray.500 | #818b9efrom color.slate.400 | ||
--component-card-glass-highlight | Glass card's lit top and left edges, drawn inside the outline. | color.border.glass-highlight | rgba(255, 255, 255, 0.8)from color.overlay.white-80 | rgba(255, 255, 255, 0.2)from color.overlay.white-20 | ||
--component-card-glass-backdrop-blur | Blur behind a glass card. | effect.backdrop.glass-sheer | 6pxfrom effect.blur-radius.6 | 6pxfrom effect.blur-radius.6 | ||
--component-card-glass-background-opaque | Glass card surface, at rest and on hover, under reduced transparency and in custom themes. | color.surface.raised | #fffffffrom color.gray.0 | #18202efrom color.slate.900 | ||
--component-card-focus-ring-color | Focus indicator drawn around a link card while its link has focus. | color.focus.ring | #005f7bfrom color.cyan.700 | #54d8f4from color.cyan.300 |
| Key | Action |
|---|---|
| Tab | Focuses the heading link (the ring surrounds the card), then any controls inside. |
| Enter | Follows the card's link. |