Skip to content

Card

Related content and actions, gathered on a single surface.

A moment of quiet

Alberta, Canada

Turquoise water, pine forests, and a little room to breathe.

Installation

Terminal
pnpm dlx shadcn@latest add \
  https://react-toolbox.io/r/card.json \
  https://react-toolbox.io/r/button.json

New here? Set up your project first. Styles, fonts, and required components are included. The command includes the components used by the examples below.

Usage

Card parts include Material keyline spacing; avoid adding a second layer of padding around them. Give meaningful CardMedia backgrounds alt text, or pass an image with its own alt. Use aspectRatio="wide" for 16:9 media. Photo by Andrew Maranta on Unsplash.

API reference

Key props and defaults. Full types and inline documentation are included with the source in material/card.

Card

Property Type Default
raised boolean —

CardMedia

Property Type Default
alt string

Alternative text for a background image; omit for decorative media.

—
aspectRatio 'wide' | 'square' —
contentOverlay boolean —
image ReactNode —

Material guidelines

  • Group content about one subject. Use a consistent width across a collection while allowing cards to grow with their content.
  • Make the main destination clear and limit competing secondary actions. A whole-card link needs visible focus and press feedback; avoid nesting buttons inside that link.

Material Design 1: Cards