--- name: nested-card description: Creates cards with an outer gradient container and inner content card. Use when building premium card designs with depth, layered card layouts, or cards with image sections and content sections. --- # Nested Card Pattern Build premium card designs with an outer gradient container wrapping an inner content card, creating visual depth and separation between media and content areas. ## Structure Overview ``` ┌─────────────────────────────┐ ← Outer card (gradient bg, padding) │ ┌───────────────────────┐ │ │ │ Image/Media │ │ ← Media section (rounded) │ └───────────────────────┘ │ │ ┌───────────────────────┐ │ │ │ Content Card │ │ ← Inner card (solid bg) │ └───────────────────────┘ │ └─────────────────────────────┘ ``` ## Core Implementation ### Light Mode ```tsx
{/* Media section */}
{/* Image, carousel, or media content */}
{/* Inner content card */}
{/* Card content */}
``` ### Dark Mode ```tsx
{/* Media section */}
{/* Image, carousel, or media content */}
{/* Inner content card */}
{/* Card content */}
``` ## Token Reference | Element | Light Mode | Dark Mode | |---------|------------|-----------| | **Outer card** | | | | Background | `bg-gradient-to-b from-[#e8e8ea] to-[#dcdce0]` | `bg-gradient-to-b from-zinc-700 to-zinc-800` | | Border | `border-white/60` | `border-zinc-600/40` | | Shadow | `shadow-xl shadow-zinc-400/30` | `shadow-xl shadow-black/50` | | Border radius | `rounded-3xl` | `rounded-3xl` | | Padding | `p-2` | `p-2` | | **Media section** | | | | Border | `border-white/40` | `border-zinc-600/30` | | Border radius | `rounded-2xl` | `rounded-2xl` | | **Inner card** | | | | Background | `bg-white` | `bg-zinc-900` | | Border radius | `rounded-2xl` | `rounded-2xl` | | Padding | `px-5 py-4` | `px-5 py-4` | ## Sizing Variations ### Preview (compact) ```tsx // Outer
{/* Media: h-[140px], rounded-xl */} {/* Inner: rounded-xl, px-3.5 py-3 */}
``` ### Detail Page (full) ```tsx // Outer
{/* Media: h-[240px], rounded-2xl */} {/* Inner: rounded-2xl, px-5 py-4 */}
``` | Context | Outer Radius | Inner Radius | Padding | Media Height | |---------|-------------|--------------|---------|--------------| | Preview | `rounded-2xl` | `rounded-xl` | `p-1.5` | `h-[140px]` | | Detail | `rounded-3xl` | `rounded-2xl` | `p-2` | `h-[240px]` | ## Full Example ```tsx function ProductCardLight() { return (
{/* Image section */}
Product
{/* Content section */}
{/* Header */}

Product Title

$99
{/* Description */}

Product description goes here.

{/* Tags or features */}
Feature 1 Feature 2
); } ``` ## Variations ### Without Media Section ```tsx
{/* Content only */}
``` ### Multiple Inner Sections ```tsx
{/* Media */}
...
{/* Stats bar */}
...
{/* Main content */}
...
``` ## Checklist - [ ] Outer card uses gradient background - [ ] Border radius decreases inward (3xl → 2xl → xl) - [ ] Inner sections have consistent gap (`mb-2` or `gap-2`) - [ ] Media section has `overflow-hidden` - [ ] Shadow appropriate for theme - [ ] Border opacity creates subtle depth