Card
Displays a card with header, content, and footer. The default variant uses a frosted glass effect. Use variant="solid" for a flat card with a solid background.
Solid Variant
Use variant="solid" for a flat card with a solid background and border.
<Card variant="solid">
<CardHeader>
<CardTitle>Solid Card</CardTitle>
<CardDescription>A flat card with a solid background.</CardDescription>
</CardHeader>
<CardContent>
<p>Card Content</p>
</CardContent>
<CardFooter>
<p>Card Footer</p>
</CardFooter>
</Card>Selectable
Cards can be made selectable with selectable="standard" or selectable="ai". Selectable cards render as a <button> with aria-pressed for accessibility. They show a glow effect on hover and when selected. The ai glow uses the AI gradient; see the AI Toolkit for guidance and richer AI card compositions.
<Card selectable="standard" selected={selected} onClick={() => setSelected(!selected)}>
<CardTitle>Standard</CardTitle>
<CardDescription>Click to select this card.</CardDescription>
</Card>
<Card selectable="ai" selected={selected} onClick={() => setSelected(!selected)}>
<CardTitle>AI Mode</CardTitle>
<CardDescription>Uses an AI gradient glow when selected.</CardDescription>
</Card>AI glow
A glow, an AI gradient shadow, can sit behind a card or a group of cards to mark it as AI without a border or a solid fill. It is a composition rather than a Card prop: render the AiGlow primitive as the first child of a relative parent, then layer the content above it in its own relative wrapper. The glow is decorative, so it is aria-hidden and ignores pointer events. For when to reach for a glow, see the AI Toolkit.
Give the card the translucent AI glass surface (variant="glass" with bg-[var(--ai-glass)]) so the colored glow reads through it instead of sitting behind an opaque fill.
Behind a single card
The card variant is a soft blurred blob. Pair it with a label so the emphasis is explained, and limit it to one best match per view.
<div className="relative">
<AiGlow />
<div className="relative">
<Card variant="glass" className="bg-[var(--ai-glass)] dark:bg-[var(--ai-glass)]">
{/* ... */}
</Card>
</div>
</div>Behind a card group
The group variant is a wider, amorphous wash. Set the AI context once at the group level instead of marking every card, so the mark keeps its meaning.
<div className="relative">
<AiGlow variant="group" />
<div className="relative grid gap-4 sm:grid-cols-2">
<Card variant="glass" className="bg-[var(--ai-glass)] dark:bg-[var(--ai-glass)]">
{/* ... */}
</Card>
{/* ...more cards */}
</div>
</div>Installation
npx shadcn@latest add @uipath/cardUsage
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
GLASS_CLASSES,
} from "@/components/ui/card"<Card>
<CardHeader>
<CardTitle>Card Title</CardTitle>
<CardDescription>Card Description</CardDescription>
</CardHeader>
<CardContent>
<p>Card Content</p>
</CardContent>
<CardFooter>
<p>Card Footer</p>
</CardFooter>
</Card>GLASS_CLASSES
The GLASS_CLASSES constant is exported for reuse in other components that need the same frosted glass styling:
import { GLASS_CLASSES } from "@/components/ui/card"
<div className={cn(GLASS_CLASSES, "p-4")}>
Glass morphism container
</div>