Skip to main content

Card

Every example on this page is live, drawn by the library's Storybook, where you can also change its props and see the result.

A bordered container with optional header and footer sections.

Import​

import { Card } from "~lib/layout/card";

Props​

NameTypeRequiredDefaultDescription
childrenReactNodeYesN/ACard body content
titlestringNoN/AHeader text, kept to one line
footerReactNodeNoN/AFooter content
padding"none" | "sm" | "md" | "lg"No"md"Body padding
fillbooleanNofalseFill the parent's height

Examples​

Simple​

Open Simple in Storybook

With Title​

Open With Title in Storybook
Open With Title And Footer in Storybook

Long Title​

The title always stays on one line and ends in "…" when it does not fit, so a long title in a slim column never takes room from the body.

Open Long Title in Storybook

No Padding​

Open No Padding in Storybook

Fill​

Set fill to stretch the card to the height of whatever it sits in. The body then takes the room the title and footer leave, so a chart inside with width="100%" height="100%" grows to fit without you working out its height.

Open Fill in Storybook

See Also​

  • Divider - Separator
  • Brim - Clips a body that may hold more than a fill card leaves, with a fade
  • Fade - Fade transition