Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Card examples · Standard

Standard Card for React

A basic card with a title, a description, a content area and two action buttons.

Framework
UI library

Cards are everywhere: dashboards, profiles, product listings. This React card is the starting point, with a header holding a title and a description, a content area, and a footer with Cancel and Submit. Use it for any block of content that needs its own border and spacing, then fill each part with what you need.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

Which card parts does this demo use?

Card, then CardHeader with CardTitle and CardDescription, then CardContent with a paragraph, then CardFooter with two buttons. Every part is optional: leave out the ones you don't need.

How wide is the card?

Up to 350px: w-full max-w-[350px] on Card, so it shrinks on narrow screens. The parts stack in a column, and the card sets the gaps between them.

Can the header take the title and description as props?

Yes. Pass title and description on CardHeader and it renders CardTitle and CardDescription for you. Use the parts, as here, when the title needs its own markup.

How do I put a button in the header's corner?

Add CardAction inside CardHeader, after the title and the description. The header turns into two columns and the action sits at the top on the end side.

How do I tighten the card?

Pass size="sm" on Card for the compact preset. For your own value, set the --card-spacing variable on the card, which sets the gaps and the insets of every part.