Staaarter

Stacked Card Flip

A vertical stack of FAQ cards that overlap with slight negative margins and alternating tilt in their resting state, suggesting a physical stack of index cards. Clicking a card straightens it and expands it in place to reveal its answer.

By Staaarter Team
FAQ
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/stacked-card-flip.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/faq/faq65.tsx instead.

Usage

The file also exports faq65Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Faq65, faq65Demo } from "@/components/blocks/faq/faq65";

export default function Page() {
  return <Faq65 {...faq65Demo} />;
}

Props

PropTypeDefaultDescription
badgestringnoneSmall eyebrow label above the heading.
headingstringnoneSection heading.
descriptionstringnoneSection intro text.
itemsFaqItem[]noneQuestions rendered as cards in the stack.
classNamestringnoneExtra classes for the outer section element.

Types

type FaqItem = {
  question: string;
  answer: string;
};

Behavior notes

  • "use client" because each card is a real accordion holding local open-index state, only one card open at a time.
  • The stack metaphor comes entirely from resting-state styling: cards overlap via negative top margin and each carries a small fixed rotation cycled from a 6-value array by index, not Math.random(), so the layout is stable across server and client renders.
  • Clicking a card removes its rotation, raises its stacking order (z-index) above the rest, and expands its answer inline; later cards in the stack are pushed down by normal document flow rather than by an animated push effect.