import {
DesignCard,
DesignCardHeader,
DesignCardTitle,
DesignCardDescription,
DesignCardContent,
DesignCardFooter,
} from "@/components/ui/design-card";
import { Separator } from "@/components/ui/separator"; // For footer dividerDesignCard uses composition pattern - combine sub-components as needed
<DesignCard>
<DesignCardHeader> {/* padding: 24px 24px 16px 24px */}
<DesignCardTitle> {/* text-h5, font-primary */}
Title
</DesignCardTitle>
<DesignCardDescription> {/* text-body, font-secondary */}
Description text
</DesignCardDescription>
</DesignCardHeader>
<DesignCardContent> {/* padding: 0 24px 24px 24px */}
Main content here
</DesignCardContent>
<div className="px-6"> {/* Wrapper for separator */}
<Separator />
</div>
<DesignCardFooter> {/* padding: 16px 24px 24px 24px, flex gap-2 */}
<DesignButton>Action</DesignButton>
</DesignCardFooter>
</DesignCard>Main container component
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Card content - use sub-components for structure |
className | string | - | Additional CSS classes (e.g., custom padding) |
All sub-components accept className and standard HTML div attributes
| Prop | Type | Default | Description |
|---|---|---|---|
DesignCardHeader | Component | - | Container for title and description. Padding: 24px 24px 16px 24px |
DesignCardTitle | Component | - | Card title. Typography: text-h5, color: font-primary |
DesignCardDescription | Component | - | Card description. Typography: text-body, color: font-secondary |
DesignCardContent | Component | - | Main content area. Padding: 0 24px 24px 24px |
DesignCardFooter | Component | - | Action buttons area. Layout: flex gap-2, padding: 16px 24px 24px 24px |
<DesignCard className="p-6">
<h4 className="text-h5 text-[var(--color-font-primary)] mb-2">Card Title</h4>
<p className="text-body text-[var(--color-font-secondary)]">
Card content goes here.
</p>
</DesignCard><DesignCard>
<DesignCardHeader>
<DesignCardTitle>Settings</DesignCardTitle>
<DesignCardDescription>Manage your preferences</DesignCardDescription>
</DesignCardHeader>
<DesignCardContent>
{/* Your form or content here */}
</DesignCardContent>
</DesignCard><DesignCard>
<DesignCardHeader>
<DesignCardTitle>Confirm Action</DesignCardTitle>
<DesignCardDescription>Are you sure you want to proceed?</DesignCardDescription>
</DesignCardHeader>
<DesignCardContent>
<p className="text-body text-[var(--color-font-secondary)]">
This action cannot be undone.
</p>
</DesignCardContent>
<div className="px-6"><Separator /></div>
<DesignCardFooter>
<DesignButton variant="primary" leftIcon={<DesignIcon name="check" />}>
Confirm
</DesignButton>
<DesignButton variant="tertiary">Cancel</DesignButton>
</DesignCardFooter>
</DesignCard><DesignCard>
<DesignCardHeader>
<DesignCardTitle>Analytics</DesignCardTitle>
</DesignCardHeader>
<DesignCardContent>
<div className="space-y-3">
<div className="flex justify-between items-center">
<span className="text-body text-[var(--color-font-secondary)]">Total Views</span>
<span className="text-h5 text-[var(--color-font-primary)]">1,234</span>
</div>
<div className="flex justify-between items-center">
<span className="text-body text-[var(--color-font-secondary)]">Engagement</span>
<span className="text-h5 text-[var(--color-font-primary)]">5.6%</span>
</div>
</div>
</DesignCardContent>
</DesignCard><DesignCard className="p-2">
<div className="flex gap-2">
<DesignButton variant="primary" size="small" leftIcon={<DesignIcon name="open" />}>
Publish
</DesignButton>
<DesignButton variant="secondary" size="small" leftIcon={<DesignIcon name="date" />}>
Schedule
</DesignButton>
</div>
</DesignCard>Use full structure with Header, Content, and Footer
<DesignCard>
<DesignCardHeader>
<DesignCardTitle>Account Settings</DesignCardTitle>
<DesignCardDescription>Update your profile information</DesignCardDescription>
</DesignCardHeader>
<DesignCardContent>
{/* Form fields */}
</DesignCardContent>
<div className="px-6"><Separator /></div>
<DesignCardFooter>
<DesignButton variant="primary">Save Changes</DesignButton>
</DesignCardFooter>
</DesignCard>Use Header with Title only, Content for data
<DesignCard>
<DesignCardHeader>
<DesignCardTitle>Weekly Performance</DesignCardTitle>
</DesignCardHeader>
<DesignCardContent>
{/* Stats or charts */}
</DesignCardContent>
</DesignCard>Full structure with emphasized footer actions
<DesignCard>
<DesignCardHeader>
<DesignCardTitle>Delete Draft?</DesignCardTitle>
<DesignCardDescription>This cannot be undone.</DesignCardDescription>
</DesignCardHeader>
<div className="px-6"><Separator /></div>
<DesignCardFooter>
<DesignButton variant="primary">Delete</DesignButton>
<DesignButton variant="tertiary">Cancel</DesignButton>
</DesignCardFooter>
</DesignCard>Just DesignCard with className for padding
<DesignCard className="p-4">
<p className="text-body text-[var(--color-font-secondary)]">
Simple content without structure.
</p>
</DesignCard>Use sub-components for structured layouts
<DesignCard>
<DesignCardHeader>
<DesignCardTitle>Title</DesignCardTitle>
</DesignCardHeader>
<DesignCardContent>Content</DesignCardContent>
</DesignCard>Use Separator before DesignCardFooter for visual divider
<DesignCardContent>...</DesignCardContent>
<div className="px-6"><Separator /></div>
<DesignCardFooter>...</DesignCardFooter>Override padding via className when needed
<DesignCard className="p-4">
Custom padded content
</DesignCard>Keep inner content backgrounds transparent
<DesignCard>
<div className="p-4">{/* No bg-* class */}
Content here
</div>
</DesignCard>Don't add background colors to inner containers
// β Bad - creates visual noise
<DesignCard>
<div className="p-4 bg-gray-100">Content</div>
</DesignCard>
// β
Good - transparent inner content
<DesignCard>
<div className="p-4">Content</div>
</DesignCard>Don't nest DesignCard inside DesignCard
// β Bad - nested cards
<DesignCard>
<DesignCard>Nested</DesignCard>
</DesignCard>
// β
Good - single card with sections
<DesignCard>
<div className="border-b">Section 1</div>
<div>Section 2</div>
</DesignCard>Don't skip Header and put title directly in Content
// β Bad - inconsistent structure
<DesignCard>
<DesignCardContent>
<h3>Title Here</h3>
Content...
</DesignCardContent>
</DesignCard>
// β
Good - use proper structure
<DesignCard>
<DesignCardHeader>
<DesignCardTitle>Title Here</DesignCardTitle>
</DesignCardHeader>
<DesignCardContent>Content...</DesignCardContent>
</DesignCard>Interactive examples showing all patterns
Card with custom padding
Simple card content without sub-components.
<DesignCard className="p-6">
<h4 className="text-h5 text-[var(--color-font-primary)] mb-2">
Card Title
</h4>
<p className="text-body text-[var(--color-font-secondary)]">
Simple card content
</p>
</DesignCard>Using DesignCardHeader and DesignCardTitle
<DesignCard>
<DesignCardHeader>
<DesignCardTitle>Analytics Overview</DesignCardTitle>
<DesignCardDescription>
Your performance this week
</DesignCardDescription>
</DesignCardHeader>
<DesignCardContent>
Content area
</DesignCardContent>
</DesignCard>Full structure with action buttons
Are you sure you want to proceed with this action?
<DesignCard>
<DesignCardHeader>
<DesignCardTitle>Confirm Action</DesignCardTitle>
<DesignCardDescription>
Please review before proceeding
</DesignCardDescription>
</DesignCardHeader>
<DesignCardContent>...</DesignCardContent>
<div className="px-6"><Separator /></div>
<DesignCardFooter>
<DesignButton variant="primary">Confirm</DesignButton>
<DesignButton variant="tertiary">Cancel</DesignButton>
</DesignCardFooter>
</DesignCard>Card as toolbar container
<DesignCard className="p-2">
<div className="flex gap-2">
<DesignButton variant="primary" size="small" leftIcon={<DesignIcon name="open" />}>
Publish
</DesignButton>
<DesignButton variant="secondary" size="small" leftIcon={<DesignIcon name="date" />}>
Schedule
</DesignButton>
</div>
</DesignCard>Form-like settings panel
<DesignCard>
<DesignCardHeader>
<DesignCardTitle>Project Settings</DesignCardTitle>
<DesignCardDescription>
Manage your project configuration
</DesignCardDescription>
</DesignCardHeader>
<DesignCardContent>
{/* Settings fields */}
</DesignCardContent>
<div className="px-6"><Separator /></div>
<DesignCardFooter>
<DesignButton variant="primary">Save</DesignButton>
<DesignButton variant="secondary">Reset</DesignButton>
</DesignCardFooter>
</DesignCard>Card with stacked items
<DesignCard className="p-3 space-y-2">
<div className="text-sm text-[var(--color-font-primary)]">Item 1</div>
<div className="text-sm text-[var(--color-font-primary)]">Item 2</div>
<div className="text-sm text-[var(--color-font-primary)]">Item 3</div>
</DesignCard>Content containers inside DesignCard should NOT have background colors.
The card itself provides the visual container with surface-200 background. Adding additional background colors to inner content creates visual noise and breaks the design hierarchy.