Card

Container with header, content, and footer sections.

Report a bug

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Installation

pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/card.json

Storybook

Explore all variants, controls, and accessibility checks in the interactive Storybook playground.

View in Storybook

Code

import * as React from "react"; import { cn } from "../../lib/utils"; const Card = React.forwardRef< HTMLDivElement, React.HTMLAttributes<HTMLDivElement> >(({ className, ...props }, reference) => ( <div className={cn( "rounded-lg border bg-card text-card-foreground shadow-sm", className, )} ref={reference} {...props} /> )); Card.displayName = "Card"; const CardHeader = React.forwardRef< HTMLDivElement, React.HTMLAttributes<HTMLDivElement> >(({ className, ...props }, reference) => ( <div className={cn("flex flex-col space-y-1.5 p-6", className)} ref={reference} {...props} /> )); CardHeader.displayName = "CardHeader"; const CardTitle = React.forwardRef< HTMLDivElement, React.HTMLAttributes<HTMLDivElement> >(({ className, ...props }, reference) => ( <div className={cn( "text-2xl font-semibold leading-none tracking-tight", className, )} ref={reference} {...props} /> )); CardTitle.displayName = "CardTitle"; const CardDescription = React.forwardRef< HTMLDivElement, React.HTMLAttributes<HTMLDivElement> >(({ className, ...props }, reference) => ( <div className={cn("text-sm text-muted-foreground", className)} ref={reference} {...props} /> )); CardDescription.displayName = "CardDescription"; const CardContent = React.forwardRef< HTMLDivElement, React.HTMLAttributes<HTMLDivElement> >(({ className, ...props }, reference) => ( <div className={cn("p-6 pt-0", className)} ref={reference} {...props} /> )); CardContent.displayName = "CardContent"; const CardFooter = React.forwardRef< HTMLDivElement, React.HTMLAttributes<HTMLDivElement> >(({ className, ...props }, reference) => ( <div className={cn("flex items-center p-6 pt-0", className)} ref={reference} {...props} /> )); CardFooter.displayName = "CardFooter"; export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, };

Dependencies

  • @vllnt/ui@^0.2.1