Skip to content

Card

A surface that groups related content.

import { Card } from '@/design-system';

Examples

Title and inset

Newest signups

Groups related content.

An inset card
import { Card } from '@/design-system';

export default function CardBasic() {
  return (
    <Card as="section" title="Newest signups">
      <p className="text-muted">Groups related content.</p>
      <Card tone="inset" className="mt-4">
        An inset card
      </Card>
    </Card>
  );
}

Flush

Add overflow-hidden so pictures follow the rounded corners.

The picture reaches the edges.

import { Card } from '@/design-system';

export default function CardFlush() {
  return (
    <Card flush className="max-w-xs overflow-hidden">
      <div className="h-28 bg-accent/20" />
      <p className="p-4">The picture reaches the edges.</p>
    </Card>
  );
}

How it works

  • The heading is always an h2. If the page needs another level, leave out title and write your own.

Props

Other HTML attributes are passed to the element. The native title tooltip is replaced by the heading.

Card props
PropTypeDefaultDescription
as'div' | 'section' | 'li''div'The element to render.
titlestring—A level-two heading at the top.
tone'raised' | 'inset''raised'Inset uses the page background and no shadow, for a card inside a card.
flushbooleanfalseRemoves the padding.
classNamestring—Extra classes, for spacing or width. Utility classes override the component’s own styles.
childrenReactNode—The content.

Tokens

Tokens
TokenDefaultSets
--card-title-size1remTitle text size
--card-radius0.75remCorner radius
--card-padding1.25remPadding
--card-background--surfaceFill
--card-border--borderBorder colour
--card-shadownoneShadow