Card
Card example: a rounded surface with header, title, description, action, content and footer slots. A small size tightens the spacing, and an image placed first bleeds to the card's rounded corners.
pnpm dlx shadcn add @01orbital/cardimport * as React from "react"
import { cn } from "cn"
function Card({
className,
size = "default",
...props
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
return (
<div
data-slot="card"
data-size={size}
className={cn(
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-4xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-md ring-1 ring-foreground/5 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] dark:ring-foreground/10 *:[img:first-child]:rounded-t-4xl *:[img:last-child]:rounded-b-4xl",
className
)}
{...props}
/>
)
}
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-header"
className={cn(
"group/card-header @container/card-header grid auto-rows-min items-start gap-1.5 rounded-t-4xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
className
)}
{...props}
/>
)
}
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-title"
className={cn("text-base font-medium", className)}
{...props}
/>
)
}
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-description"
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
)
}
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-action"
className={cn(
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
className
)}
{...props}
/>
)
}
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-content"
className={cn("px-(--card-spacing)", className)}
{...props}
/>
)
}
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-footer"
className={cn(
"flex items-center rounded-b-4xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)",
className
)}
{...props}
/>
)
}
export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardAction,
CardDescription,
CardContent,
}
import { Button } from "@/components/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
// The copy: change text here, not in the markup.
const COPY = {
title: "Studio",
description: "Every block, every scene, and the source for both.",
body: "Install with the CLI and the files land in your repo. No runtime dependency, no lock-in.",
cta: "Get the kit",
} as const
/** Card with a header, body text and a full-width button in the footer. */
export default function CardDemo() {
return (
<Card className="max-w-sm">
<CardHeader>
<CardTitle>{COPY.title}</CardTitle>
<CardDescription>{COPY.description}</CardDescription>
</CardHeader>
<CardContent>
<p className="text-sm/6 text-muted-foreground">{COPY.body}</p>
</CardContent>
<CardFooter>
<Button className="w-full">{COPY.cta}</Button>
</CardFooter>
</Card>
)
}
Examples
New
card-paper
New
card-bevel
New
card-bevel-raised
New
card-cascade-warm
New
card-cascade-cool
New
card-color-field-frame
New
card-print-product
New
card-collection-tile
New
card-project-preview
New
card-calendar-event
New
card-dark-frame
New
card-horizontal-frame
New
card-newsletter-signup
New
card-palette-preview
New
card-clarice-open-studio
New
card-client-approval
New
card-cascade-after-hours
New
card-stock-supper-club
New
card-stock-private-viewing
New
card-stock-dispatch
New
card-stock-trail-ledger
Card components
The library's own card components, each installed on its own.
activity-feed-card
activity-goal-card
bento-cell
bento-window
cover-card
engraved-card
headline-card
metal-card
split-card
Dependencies
npm: cn. The CLI installs them for you.
No other registry pieces.