This page as markdown: /card-stack.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

CardStack

Status: stable

A compact collection of overlapping cards, opened by pressing the front card or a separate button. Expanded cards return to normal flow; back-card controls are inert while collapsed. Opening and closing is one eased movement: the height and every card travel together.

Keywords: card stack, collection, fan, stacked cards, browse collection

Usage

Use for a small collection someone can inspect together: documents, photographs or project summaries. Supply the cards; CardStack owns overlap and expansion without a second overlay or gesture dependency.

Best practices

Props

Name Type Default Description
label string — Accessible collection name.
expanded boolean — Controlled expansion.
defaultExpanded boolean false Initial uncontrolled expansion.
onExpandedChange (expanded: boolean) => void — Called by the expansion control.
trigger "button" | "stack" "button" A separate button, or the front card itself. Use stack only when the front card contains no interactive controls.
expandLabel string "Browse collection" Expansion action. Visible on the button trigger; an accessible description on the stack trigger, whose name comes from its visible content.
collapseLabel string "Collapse collection" Collapse action. Visible on the button trigger; an accessible description on the stack trigger.
motion "full" | "subtle" | "off" — Only turns motion down. Expansion remains available at every level.

Motion

Accessibility

Related

Examples

Project collection

import { Card, CardContent, CardStack } from "@sableui/react"

<CardStack label="Projects" trigger="stack" expandLabel="Show 2 projects"><Card><CardContent>Research</CardContent></Card><Card><CardContent>Design</CardContent></Card></CardStack>

Controlled and still

import { Card, CardContent, CardStack } from "@sableui/react"

const [open, setOpen] = useState(true)
<CardStack label="Documents" expanded={open} onExpandedChange={setOpen} motion="off"><Card><CardContent>Brief</CardContent></Card><Card><CardContent>Notes</CardContent></Card></CardStack>