Card
Displays a card with header, content, and footer.
Create Project
Deploy your new project in one-click.
Installation
Copy and paste the following code into your project.
import { cn } from "~/utils/tailwind";
function Card({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
className={cn(
"rounded-4 border bg-card px-6 pb-6 pt-5 text-card-foreground",
className,
)}
{...props}
/>
);
}
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div className={cn("flex flex-col gap-y-1.5 pb-5", className)} {...props} />
);
}
function CardBody({ ...props }: React.ComponentProps<"div">) {
return <div {...props} />;
}
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
return <div className={cn("flex items-center pt-6", className)} {...props} />;
}
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
return <h3 className={cn("text-5 font-semibold", className)} {...props} />;
}
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
return (
<p className={cn("text-3.5 text-muted-foreground", className)} {...props} />
);
}
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardBody };
Update the import paths to match your project setup.
Usage
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} 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>