A container that groups related content and actions — from simple panels to image-rich product, article and profile cards.
$ pnpm dlx shadcn@latest add https://dashral.com/r/card.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/card.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/cardUsage
import { Button } from "@/components/dashral/button"
import { Card } from "@/components/dashral/card"
<Card
title="Team members"
description="Invite people to work with you."
footer={<Button size="sm">Invite</Button>}
>
<p className="text-sm">3 of 5 seats used.</p>
</Card>Examples
With header action
action sits at the end of the header.
Variants
default, soft, shadow, inset and panel — set with the variant prop.
variant="default"variant="soft"variant="shadow"variant="inset"variant="panel"Inset
variant="inset": the header and footer on a tinted frame, the content on a panel set 6px into it, its corners following the frame's.
Panel
variant="panel": the same frame, the panel flush with the card's edge wherever no header or footer sits, so the two borders are one line — a list over a footer, or a header over a chart or a table.
billing-api
billing-api.acme.devShadow depths
Combine the shadow variant with any Tailwind shadow utility, or lift the card on hover.
Article with cover image
media runs to the card's edges; eyebrow sits above the title.
Product
Badge and wishlist button positioned over the image.
Horizontal
orientation="horizontal": media beside the content from the sm breakpoint; stacked on mobile.
Image overlay
padding="none" for a layout of your own; a gradient keeps text readable on any photo.
API reference
Card
Also takes every prop of <div>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
title / description | ReactNodeThe header. | — |
eyebrow | ReactNodeAbove the title, e.g. a badge. | — |
action | ReactNodeAt the end of the header, e.g. a menu button. | — |
children | ReactNodeThe content. | — |
footer | ReactNodeUnder the content, e.g. buttons. | — |
footerDivider | booleanA line above the footer. | false |
media | ReactNodeAn image flush with the edge: on top, or at the start when horizontal. | — |
orientation | "vertical" | "horizontal"horizontal puts the media beside the content from sm up. | "vertical" |
variant | "default" | "soft" | "shadow" | "inset" | "panel"Edge style; inset puts the header and footer on a tinted frame and the content on a panel set into it; panel does the same with the panel flush with the card's edge wherever no header or footer sits. "bordered" still works but is deprecated: it looks like soft. | "default" |
padding | "default" | "none"none, for a layout of your own. | "default" |
classNames | { media, section, header, eyebrow, title, description, action, body, footer }Classes for each part; section holds the padding and gap, e.g. "gap-3 py-5" for a tighter card. | — |
className | stringExtra classes, merged with cn() so yours win. | — |
Accessibility
- A plain container with no role. If a card is a link, make the title the link rather than wrapping the whole card.