Avara UI

Shadcn Card

A composable card container (Card, CardHeader, CardContent, CardFooter, ProductCard, ProjectCard) for content tiles, ecommerce cards, profiles, and editorial grids.

Applies to this page's previews only

About Shadcn Card

What it is. A composable suite of card primitives (Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter) alongside specialized ProductCard and ProjectCard layouts for editorial, ecommerce, profile, and dashboard tiles.

How it is built. Card is a plain div styled with theme tokens (bg-card, text-card-foreground). It is lit by a soft shadow and a tonal step rather than a border, in three variant surfaces, with an optional interactive hover lift. Each card and its CardHeader, CardContent and CardFooter blur in once as the card scrolls into view, and stand still under prefers-reduced-motion. ProductCard lives in ProductCardBlock, and ProjectCard is exported from CardBlock. Motion uses CSS transitions and the Web Animations API, nothing imports next/*, and the icons come from ui-animated-icons.

When to use it. Use Card whenever related metadata, media, and actions belong in a distinct surface. For stacked/draggable decks or 3D tilt cards, see Card Stack or Tilted Card.

For AI agents

Hand your agent this brief or the Markdown page, not a screenshot.

When to use

  • Grouping headers, media, metrics, or actions into editorial, product, profile, or stat cards
  • Interactive clickable cards (interactive prop) or ecommerce product tiles (ProductCard)

When not to use

Agent notes

  • Named exports: Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter and ProjectCard from @/components/custom/blocks/CardBlock; ProductCard from @/components/custom/blocks/ProductCardBlock
  • Card variants are "bordered" (default), "default" and "flat"; add "dark" to className to pin an individual card to the dark tokens
  • Card renders a div and interactive only changes its styling. Add onClick, role and tabIndex yourself, or wrap it in a link, for a real clickable card
  • ProductCard shows its Add, Buy Now, Quick View and heart buttons only when you pass onAddToCart, onBuyNow, onQuickView and onFavoriteToggle
  • ProductCard variant="compact" is in the type but renders the same as "standard"
Install
npx shadcn@latest add https://avaraui.com/r/card.json
Registry name
@avara-ui/card, through the shadcn MCP server
Index
llms.txt lists every page, or add the agent skill once

Props Reference

Card

PropTypeDefaultDescription
variant"bordered" | "default" | "flat""bordered""bordered" is the tray (soft shadow and a faint ring), "default" a lighter lit surface, and "flat" a soft gray well with no shadow. None draws a border.
interactivebooleanfalseAdds a hover lift with a deeper shadow, a pointer cursor, and a slight press scale. It does not make the card focusable or a link.
revealbooleantrueBlurs the card and its parts in once, the first time it scrolls into view. Set false to render it at rest.
classNamestringundefinedAdditional CSS classes applied to the root element.

ProductCard

PropTypeDefaultDescription
titlestring-Product title heading (required).
pricestring-Displayed product price string (required).
variant"standard" | "compact" | "horizontal""standard""horizontal" lays the card out as a row with a small thumbnail. "compact" is accepted but renders the same as "standard".
subtitlestringundefinedBrand name, category or secondary label.
descriptionstringundefinedDetailed product description text.
originalPricestringundefinedStrikethrough original price for discount display.
ratingnumberundefinedStar rating score (e.g. 4.8).
reviewsCountnumberundefinedTotal review count displayed beside rating.
badgestringundefinedTag label displayed on top corner (e.g. "Best Seller").
badgeVariant"emerald" | "rose" | "indigo" | "amber" | "zinc""emerald"Color theme of the badge tag.
inStockbooleantrueShows availability indicator badge on image header.
imageReactNodeundefinedImage or visual graphic node for the product preview.
colorsProductColorOption[]undefinedArray of color swatch options { name, value }, where value is a Tailwind background class such as bg-indigo-600. Standard layout only.
onAddToCart() => voidundefinedCallback triggered when clicking the Add to Cart button.
onBuyNow() => voidundefinedCallback triggered when clicking Buy Now button.
onQuickView() => voidundefinedCallback triggered when clicking Quick View button.
onFavoriteToggle(isLiked: boolean) => voidundefinedCallback when heart button is toggled.

ProjectCard

PropTypeDefaultDescription
titlestring"Platform grid"The primary title of the component or showcase.
imagestringBuilt-in sample imageImage URL displayed in the left visual card presentation frame.
slugstringtitle, lower-cased and hyphenatedComponent slug used in the CLI install bar and package name.
scopestring"avara-ui"Registry namespace shown as @scope/slug and used in the install command.
badge1string"Component Block"First category pill badge (rose outline style).
badge2string"TypeScript & Tailwind"Second category pill badge (amber/neutral style).
descriptionstringBuilt-in sample textDetailed editorial narrative of the component or block.
specsProjectCardSpec[]Default 2x2 gridArray of { label, value } specifications displayed in the 2x2 rounded grid.
ctaLabelstring"Full View"Label for the primary branded action button.
ctaHrefstring"#"Target URL when clicking the primary action.
contactLabelstring"Contact"Label for the secondary outline contact button.
installCommandstringnpx shadcn@latest add @scope/slugCustom CLI command string for the copyable bottom terminal bar.

Works with other components

What is the difference between Card, ProductCard, and ProjectCard?

Card is the general-purpose container composed from CardHeader, CardContent, and CardFooter. ProductCard (ProductCardBlock) adds ecommerce slots for pricing, ratings, color swatches and add-to-cart actions, while ProjectCard provides a two-column showcase with specifications and a copyable install bar.

How do I make a Card react to hover with the interactive prop?

interactive adds a small lift, a shadow, a stronger border, a pointer cursor and a press scale. It is styling only: Card stays a div, so add onClick, role and tabIndex={0}, or wrap the card in a link, to make it actually clickable and keyboard reachable.

How can I pin a single Card to dark mode?

Add "dark" to that Card's className. The dark class re-applies your dark theme tokens inside the card, so bg-card and text-card-foreground switch while the rest of the page keeps its theme. It needs the usual shadcn setup, with dark tokens defined under .dark.

How do I add color swatches and buy buttons to ProductCard?

Pass colors as an array of { name, value }, where value is a Tailwind background class such as bg-indigo-600. Buttons appear only for callbacks you provide: onAddToCart, onBuyNow, onQuickView and onFavoriteToggle. Swatches report picks through onColorChange, and defaultColorIndex sets the starting one.

What do the ProductCard variants standard, compact and horizontal do?

"standard" is the vertical card with an image header, ratings, swatches and action buttons. "horizontal" is a row with a thumbnail, badge, rating, title, price and a single Add button. "compact" is declared in the type but has no layout of its own, so it renders as "standard".

How do I set the install command shown on ProjectCard?

ProjectCard builds npx shadcn@latest add @scope/slug from scope (default "avara-ui") and slug, which defaults to the hyphenated title. Pass installCommand to replace the whole string. ctaHref opens in a new tab, and onCtaClick and onContactClick handle the two buttons.