Style Catalog/Card Stack

Card Stack

卡片堆叠布局

B
86/100Good
Rate this style

3D layout with overlapping cards, creating depth through Z-axis stacking and offsets. Ideal for carousels, step-by-step displays, and card deck selection.

card stackstacked cardscard deck3D cardscard carouselswipeable cardsz-axis layeringoverlapping cardsdepth effectonboarding cards
View Full Showcase →
Templates

Best For

card stack / stacked cards / card deck

Primary Move

Use transform and z-index to create stacking effects

Watch Out

Do not stack too many cards causing clutter

AI Implementation

Copy the Hard Prompt first, then use the spec when needed

Use the Hard Prompt by default to generate UI. Use the Design Spec to understand, modify, and review the style. Use the Creative Brief for early exploration.

Hard Prompt

Use this by default: copy it, append the concrete requirement, and let AI generate consistent production UI.

When to use

  • When AI should generate UI directly
  • When repeated outputs must stay consistent
  • When style drift is the main risk

How to use

  • Copy the full prompt
  • Append the concrete requirement
  • Review against forbidden rules and UI states
STYLEKIT_STYLE_REFERENCE
style_name: Card Stack
style_slug: card-stack
style_source: /styles/card-stack

# Hard Prompt

## When To Use
Use this when you want AI to generate code with strict style consistency. It is the safest default for production UI.

## How To Use
- Copy the full prompt into ChatGPT, Claude, Cursor, or another coding assistant.
- Append the concrete product/page requirement after the prompt.
- After generation, check the forbidden rules and interaction states before accepting the output.

Strictly follow the style rules below and maintain consistency. No style drift allowed.

## Requirements

- Prioritize style consistency first, then creative extension.
- When conflicts arise, treat prohibitions as the highest priority.
- Self-check before output: verify colors, typography, spacing, and interactions still match this style.

## Style Rules

You are a frontend expert specializing in Card Stack layout. All generated code must strictly follow these constraints:

## Absolute Prohibitions

- Do NOT stack too many visible cards (max 3-5)
- Do NOT overlap cards completely (need visual distinction)
- Do NOT forget interaction feedback
- Do NOT use overly complex animations
- Do NOT use complex gestures on mobile
- Do NOT leave back cards static during hover (kills depth illusion)

## Must Follow

- Use transform for positioning: scale, translateY, rotate
- Use z-index for layering: z-30, z-20, z-10
- Progressive opacity: 100%, 80%, 60%
- Smooth transitions: transition-all duration-[400ms] ease-out
- Clear hover/active states
- Limit visible cards: 3-5 maximum

## Animation & Interaction Rules

- Deck Shuffling: On group-hover, back cards fan out sideways with different rotate + translate-x values, like shuffling a deck of cards.
- 3D Peeling: Top card on hover should significantly lift (group-hover:-translate-y-6 group-hover:scale-105 group-hover:shadow-2xl), simulating physical card being raised.
- Smooth Return: Use ease-out so cards snap back naturally from fast to slow.
- Stack Peek: Slightly change back card opacity on hover to hint their presence.

## Stack Structure

Container:
- relative position with group class for sibling interactions
- flex center alignment
- Fixed height for consistent layout

Cards (front to back):
- Card 1 (front): z-30, scale-100, opacity-100
- Card 2 (mid): z-20, scale-95, translateY-4, rotate-2, opacity-80
- Card 3 (back): z-10, scale-90, translateY-8, rotate(-3), opacity-60

On group-hover:
- Card 1: -translate-y-6, scale-105, shadow-2xl
- Card 2: rotate-6, translate-x-(-5), translate-y-8
- Card 3: -rotate-6, translate-x-5, translate-y-14

## Self-Check

After generating code, verify:
1. Cards are visually layered with different scale + opacity
2. group-hover fans back cards out to the sides
3. Front card lifts dramatically on hover
4. Max 3-5 visible cards
5. Mobile-friendly touch targets

---

# Card Stack Design System

> 3D layout with overlapping cards, creating depth through Z-axis stacking and offsets. Ideal for carousels, step-by-step displays, and card deck selection.

## Design Philosophy

Card Stack is a layout approach that creates depth perception using the Z-axis, with multiple cards overlapping front to back to form visual layers.

Core principles:
- Depth perception: Layering implies more content beneath
- Focus guidance: The frontmost card receives the most attention
- Interaction expectation: Implies the ability to flip or switch cards
- Space efficiency: Display multiple options in limited space
- Shuffle dynamics: On hover, the deck fans out like holding a hand of cards

---

## Token Dictionary (exact class mapping)

### Border
```
Width: border
Color: border-zinc-200
Radius: rounded-2xl
```

### Shadow
```
sm: shadow-md
md: shadow-xl
lg: shadow-2xl
hover: hover:shadow-2xl
focus: focus:shadow-xl
```

### Interaction
```
Hover translate: (none)
Hover scale: hover:scale-105
Hover opacity: (none)
Transition: transition-all duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]
Active: active:scale-95
```

### Typefaces
```
Heading: font-bold tracking-tight
Body: font-sans
Mono: font-mono
```

### Type scale
```
Hero: text-3xl md:text-4xl lg:text-5xl
H1: text-2xl md:text-3xl
H2: text-xl md:text-2xl
H3: text-lg md:text-xl
Body: text-sm md:text-base
Small: text-xs md:text-sm
```

### Spacing
```
Section: py-16 md:py-20 lg:py-24
Container: px-4 md:px-8
Card: p-6 md:p-8
Gap sm: gap-2 md:gap-3
Gap md: gap-4 md:gap-6
Gap lg: gap-6 md:gap-8
```

### Color roles
```
Background primary: bg-gradient-to-br from-slate-900 to-slate-800
Background secondary: bg-white
Background accent: bg-[#6c5ce7], bg-[#00cec9], bg-[#fd79a8], bg-[#ffeaa7]
Text primary: text-zinc-900
Text secondary: text-zinc-600
Text muted: text-zinc-400
Button primary: bg-zinc-900 text-white
Button secondary: bg-white/10 text-white
```

---

## [FORBIDDEN]

These classes are banned in this style. Check for them before returning code:

### Banned classes
- `rounded-none`
- `shadow-none`
- `border-4`
- `border-8`

### Banned patterns
- matches `^rounded-none$`
- matches `^border-[48]`

### Why they are banned
- `rounded-none`: Card Stack uses generous rounding (rounded-2xl) for soft stacked cards
- `shadow-none`: Card Stack requires shadows to convey depth and layering
- `border-4`: Card Stack uses subtle or no borders, relying on shadows for definition

> WARNING: if your code contains any of the above, replace it before shipping.

---

## [REQUIRED]

### Every button must include
```
rounded-full
shadow-lg
hover:shadow-xl
transition-shadow
```

### Every card must include
```
rounded-2xl
shadow-xl
transition-all duration-300
bg-white
```

### Every input must include
```
bg-white/80 backdrop-blur
border border-zinc-200
rounded-xl
focus:outline-none
focus:ring-2 focus:ring-purple-500/30
transition-all
```

---

## [COMPARE] Card Stack wrong vs right

The wrong examples below stand for generic library defaults that were never adapted to this style. Do not read them as visual suggestions.

### Button

[WRONG] **Wrong** (generic component library default, do not copy):
```html
<button class="{GENERIC_LIBRARY_BUTTON_DEFAULT}">
 Click me
</button>
```

[CORRECT] **Right** (uses this style's tokens):
```html
<button class="rounded-full shadow-lg hover:shadow-xl transition-shadow bg-zinc-900 text-white">
 Click me
</button>
```

### Card

[WRONG] **Wrong** (generic card, not adapted to this style):
```html
<div class="{GENERIC_LIBRARY_CARD_DEFAULT}">
 <h3>{TITLE}</h3>
</div>
```

[CORRECT] **Right** (uses this style's card tokens):
```html
<div class="rounded-2xl shadow-xl transition-all duration-300 bg-white p-6 md:p-8">
 <h3 class="font-bold tracking-tight text-lg md:text-xl">{TITLE}</h3>
</div>
```

### Input

[WRONG] **Wrong** (generic input, not adapted to this style):
```html
<input class="{GENERIC_LIBRARY_INPUT_DEFAULT}" />
```

[CORRECT] **Right** (uses this style's input tokens):
```html
<input class="bg-white/80 backdrop-blur border border-zinc-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500/30 transition-all" placeholder="{PLACEHOLDER}" />
```

---

## [TEMPLATES] Card Stack page skeletons

These skeletons use this style's tokens only. Replace `{PLACEHOLDER}` values, but keep every token in place:

### Navigation
```html
<nav class="bg-gradient-to-br from-slate-900 to-slate-800 text-zinc-900 border border-zinc-200 px-4 md:px-8">
 <div class="flex items-center justify-between max-w-6xl mx-auto gap-4 md:gap-6">
 <a href="/" class="font-bold tracking-tight text-lg md:text-xl">
 {LOGO_TEXT}
 </a>
 <div class="flex gap-4 md:gap-6 font-sans text-xs md:text-sm">
 {NAV_LINKS}
 </div>
 </div>
</nav>
```

### Hero section
```html
<section class="bg-[#6c5ce7] text-zinc-900 py-16 md:py-20 lg:py-24 px-4 md:px-8">
 <div class="max-w-4xl mx-auto">
 <h1 class="font-bold tracking-tight text-3xl md:text-4xl lg:text-5xl">
 {HEADLINE}
 </h1>
 <p class="font-sans text-sm md:text-base max-w-xl">
 {SUBHEADLINE}
 </p>
 <button class="rounded-full shadow-lg hover:shadow-xl transition-shadow bg-zinc-900 text-white">
 {CTA_TEXT}
 </button>
 </div>
</section>
```

### Card grid
```html
<section class="bg-gradient-to-br from-slate-900 to-slate-800 text-zinc-900 py-16 md:py-20 lg:py-24 px-4 md:px-8">
 <div class="max-w-6xl mx-auto">
 <h2 class="font-bold tracking-tight text-xl md:text-2xl">{SECTION_TITLE}</h2>
 <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6">
 <!-- Card template - repeat for each card -->
 <div class="rounded-2xl shadow-xl transition-all duration-300 bg-white p-6 md:p-8">
 <h3 class="font-bold tracking-tight text-lg md:text-xl">{CARD_TITLE}</h3>
 <p class="font-sans text-sm md:text-base text-zinc-400">{CARD_DESCRIPTION}</p>
 </div>
 </div>
 </div>
</section>
```

### Form input
```html
<input class="bg-white/80 backdrop-blur border border-zinc-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500/30 transition-all" placeholder="{PLACEHOLDER}" />
```

### Footer
```html
<footer class="bg-white text-zinc-600 py-16 md:py-20 lg:py-24 px-4 md:px-8">
 <div class="max-w-6xl mx-auto">
 <div class="grid grid-cols-1 md:grid-cols-3 gap-6 md:gap-8">
 <div>
 <span class="font-bold tracking-tight text-lg md:text-xl">{LOGO_TEXT}</span>
 <p class="font-sans text-xs md:text-sm">{TAGLINE}</p>
 </div>
 <div>
 <h4 class="font-bold tracking-tight text-lg md:text-xl">{COLUMN_TITLE}</h4>
 <ul class="font-sans text-xs md:text-sm">
 {FOOTER_LINKS}
 </ul>
 </div>
 </div>
 </div>
</footer>
```

---

## [CHECKLIST] Card Stack post-generation self check

**Before returning code, verify every token and rule below. Fix any violation before delivering:**

### Token check
- [ ] Button includes: `rounded-full shadow-lg hover:shadow-xl transition-shadow`
- [ ] Card includes: `rounded-2xl shadow-xl transition-all duration-300 bg-white`
- [ ] Input includes: `bg-white/80 backdrop-blur border border-zinc-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500/30 transition-all`

### Forbidden check
- [ ] Not using `rounded-none`
- [ ] Not using `shadow-none`
- [ ] Not using `border-4`
- [ ] Not using `border-8`

### Style rule check
- [ ] Use transform and z-index to create stacking effects
- [ ] Back cards scale down and offset scale-95 translate-y-4
- [ ] Add progressive opacity opacity-80, opacity-60
- [ ] Support drag or click to switch cards
- [ ] Add smooth transition animations transition-all duration-[400ms]

### Style drift check
- [ ] Does not violate: Do not stack too many cards causing clutter
- [ ] Does not violate: Do not completely overlap cards hiding layer distinction
- [ ] Does not violate: Do not ignore interaction feedback
- [ ] Does not violate: Do not use overly complex animations affecting performance
- [ ] Does not violate: Do not use overly complex gestures on mobile

### Delivery check
- [ ] Responsive layout holds on phone, tablet and desktop with no horizontal overflow
- [ ] Every interactive element has a visible focus state, an accessible name and a reduced-motion path
- [ ] Text contrast meets WCAG AA and colour alone never carries state
- [ ] The result is still recognizable at a glance as Card Stack

---

## [EXAMPLES] Example prompts

### 1. 

```
Create pricing cards with stack layout:
1. 3 cards stacked: Starter, Pro, Enterprise
2. Front card fully visible with details
3. Back cards scaled down, offset, and slightly rotated
4. On group-hover: back cards fan out sideways with different rotations
5. Front card lifts with scale-105 and large shadow on hover
6. Each card: plan name, price, features list, CTA
7. Navigation arrows on sides with hover feedback
Dark gradient background, white cards
```

### 2. 

 Tinder 

```
Create a Tinder-style product card stack:
1. Stack of product cards (5 cards, 3 visible)
2. Swipe right to like, left to pass
3. Each card: product image, name, price, rating
4. On hover: top card peels up (scale-105, shadow-2xl, -translate-y-6), back cards fan out
5. Swipe animation with rotation + opacity fade
6. Undo last action button
7. Fun, interactive, mobile-friendly design
```

### 3. 

```
Create an onboarding flow with card stack:
1. 4 step cards stacked
2. group-hover causes back cards to fan out with rotate + translate-x
3. Front card lifts with scale-105 and shadow-2xl
4. Click Next to advance (card slides out with rotation)
5. Progress indicator dots
6. Each card: step number, title, illustration, description
7. Final card has CTA button
Clean design with duration-[400ms] ease-out transitions
```

## Absolute Bans (Match and Refuse)

If any of the following patterns appear, it is a style violation — rewrite without exception.

- stack too many cards causing clutter
- completely overlap cards hiding layer distinction
- ignore interaction feedback
- use overly complex animations affecting performance
- use overly complex gestures on mobile
- leave back cards static on hover (lacks depth perception)

## Self-Check (Verify Before Shipping)

If any item fails, the style has drifted — fix before shipping.

- [ ] No purple-to-blue gradients
- [ ] No overused fonts (Inter, Roboto, Geist, Fraunces, Plus Jakarta Sans)
- [ ] No nested cards (cards inside cards)
- [ ] No gray text on colored backgrounds
- [ ] Body text contrast meets WCAG AA (>= 4.5:1)
- [ ] No bounce or elastic easing curves
- [ ] Animations have a prefers-reduced-motion fallback
- [ ] Body text line length capped at 65-75 characters
- [ ] No side-stripe accent borders (border-left/right > 1px)
- [ ] No gradient text (background-clip: text)
- [ ] No glassmorphism used as the default surface treatment
- [ ] No tiny uppercase tracked eyebrow labels above every section heading
- [ ] do not stack too many cards causing clutter
- [ ] do not completely overlap cards hiding layer distinction
- [ ] do not ignore interaction feedback
- [ ] do not use overly complex animations affecting performance
- [ ] do not use overly complex gestures on mobile

More prompt libraries: All UI Prompts · Tailwind UI Prompts · Dark Mode UI Prompts

Community

Ratings & Feedback

No ratings yet - be the firstSign in to rate

Loading comments…

Component Templates

Component Preview

切换按钮

用于切换卡片的导航按钮,hover 时上浮

Frontend Readiness

Dark Mode, States, Motion, and Accessibility

This layer tracks whether the style is ready for real websites: theme modes, state feedback, keyboard access, and performance constraints.

Overall

51%

Fallback

Dark Mode

0%

Missing

UI States

79%

Partial

Motion

70%

Partial

A11y

70%

Partial

Performance

35%

Fallback

Key State Coverage

light
HoverFocus VisibleDisabledLoadingEmptyErrorSuccess

Button

Default / Hover / Focus Visible / Active / Disabled

Input

Default / Hover / Focus Visible / Disabled / Error

Card

Default / Hover / Focus Visible / Loading / Skeleton

Form

Default / Focus Visible / Disabled / Loading / Error

Implementation Notes

  • No curated dark-mode contract exists yet.
  • Check contrast in both light and dark modes.
  • Check heavy shadows, blur, large media, and scroll-linked effects manually.
  • No style-specific performance cost profile has been curated yet.

FAQ

Card Stack — Frequently Asked Questions

What is the Card Stack design style?
3D layout with overlapping cards, creating depth through Z-axis stacking and offsets. Ideal for carousels, step-by-step displays, and card deck selection. Its core principle: Card Stack is a layout approach that creates depth perception using the Z-axis, with multiple cards overlapping front to back to form visual layers.
What colors does Card Stack use?
Card Stack uses #1a1a2e as its primary color and #f0f0f5 as its secondary color, with accent colors #6c5ce7, #00cec9, #fd79a8, #ffeaa7. Every hex value can be copied from the palette on this page.
How do I apply Card Stack correctly?
Key practices: Use transform and z-index to create stacking effects. Back cards scale down and offset scale-95 translate-y-4. Add progressive opacity opacity-80, opacity-60.
What are common mistakes with Card Stack?
Avoid: Do not stack too many cards causing clutter. Do not completely overlap cards hiding layer distinction. Do not ignore interaction feedback.
How do I prompt AI to generate Card Stack UI?
Copy the ready-made AI prompt on this page — it bundles the design tokens and component rules — and paste it into ChatGPT, Claude, Claude Code, or Codex. Effective prompts include the keywords: card stack, stacked cards, card deck, 3D cards.
Global Styles

Global CSS

css
/* Card Stack Global Styles */

/* Stack container */
.card-stack {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
}

/* Base card in stack */
.card-stack-item {
  position: absolute;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stack positions */
.card-stack-item:nth-child(1) {
  z-index: 30;
  transform: translateY(0) scale(1);
  opacity: 1;
}

.card-stack-item:nth-child(2) {
  z-index: 20;
  transform: translateY(16px) scale(0.95) rotate(2deg);
  opacity: 0.8;
}

.card-stack-item:nth-child(3) {
  z-index: 10;
  transform: translateY(32px) scale(0.9) rotate(-3deg);
  opacity: 0.6;
}

.card-stack-item:nth-child(n+4) {
  z-index: 0;
  transform: translateY(48px) scale(0.85);
  opacity: 0;
  pointer-events: none;
}

/* Fan out on hover — deck shuffle effect */
.card-stack:hover .card-stack-item:nth-child(1) {
  transform: translateY(-24px) scale(1.05);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
}

.card-stack:hover .card-stack-item:nth-child(2) {
  transform: translateY(32px) scale(0.95) rotate(6deg) translateX(-20px);
  opacity: 0.9;
}

.card-stack:hover .card-stack-item:nth-child(3) {
  transform: translateY(48px) scale(0.9) rotate(-6deg) translateX(20px);
  opacity: 0.8;
}

/* Tinder-style swipe */
.card-stack-swipe .card-stack-item.swiping-left {
  transform: translateX(-100%) rotate(-10deg);
  opacity: 0;
}

.card-stack-swipe .card-stack-item.swiping-right {
  transform: translateX(100%) rotate(10deg);
  opacity: 0;
}
/* Card Stack Design Tokens */
:root {
  --card-stack-primary: #1a1a2e;
  --card-stack-secondary: #f0f0f5;
  --card-stack-accent: #6c5ce7;
  --card-stack-glow: rgba(26, 26, 46, 0.3);
}

@keyframes card-stack-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-stack-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.card-stack-card {
  position: relative;
  overflow: hidden;
}

.card-stack-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.05), transparent);
  pointer-events: none;
}

.card-stack-card:hover::before {
  opacity: 1;
}

.card-stack-gradient {
  background: linear-gradient(135deg, #1a1a2e, #6c5ce7);
}

.card-stack-gradient-text {
  background: linear-gradient(135deg, #1a1a2e, #6c5ce7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-stack-frosted {
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  background: rgba(26, 26, 46, 0.08);
}

.card-stack-accent-corner {
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 2rem), calc(100% - 2rem) 100%, 0 100%);
}

.card-stack-animate-in {
  animation: card-stack-fade-in 0.5s ease-out both;
}

Compatible Visual Styles

Try Pairing

Card Stack is a layout pattern that can be paired with the following visual styles.

IDE Integration

IDE Configuration Export

Download configuration files for AI coding assistants to generate code in this style.

Style Pack

Export Style Pack

Get complete machine-readable style assets including design tokens, Tailwind presets, CSS variables, and shadcn/ui themes.

Metadata

Style metadata including version information

Design Tokens

Compatible with Figma / Style Dictionary / Tokens Studio

Tailwind Preset

Tailwind CSS theme preset, import directly in config

Global CSS

CSS variables and base styles

shadcn Theme

shadcn/ui theme configuration

CSS Variables

Pure CSS variables, works with any project

SKILL.md

Loadable skill pack for Cursor / Claude Code / VS Code

Design Philosophy

Card Stack is a layout approach that creates depth perception using the Z-axis, with multiple cards overlapping front to back to form visual layers.

Accessibility

Accessibility Score

WCAG 2.1 compliance analysis based on color contrast and typography readability.

86

Overall Score

Grade: B - Good

Contrast Ratios

Score: 86/100Average Ratio: 11.68:1
AA FailAAA Fail
ContextColorsRatioAAAAA
Text on secondary background
/#18181b / #ffffff
17.72:1
Button primary
/#ffffff / #18181b
17.72:1
Text on accent 1
/#18181b / #6c5ce7
3.65:1
Text on accent 2
/#18181b / #00cec9
9:1
Text on accent 3
/#18181b / #fd79a8
7.15:1
Text on accent 4
/#18181b / #ffeaa7
14.83:1

Readability

Score

85/100

Font Size

text-sm md:text-base

Font Weight

font-bold tracking-tight

Line Height

default

Scoring is based on WCAG 2.1 standards. AA requires 4.5:1 contrast for normal text, 3:1 for large text; AAA requires 7:1 for normal text, 4.5:1 for large text.

Design Recipes

Recommended Combinations with Card Stack

These curated recipes combine this style with layouts and animations, optimized for specific use cases.