Stack

Isometric 3D card-stack illustration. Layers lift apart on hover and assemble on entrance; the thickness, outline, and motion all follow the chosen recede direction.

Default

A three-layer stack with an icon on the front layer - the empty-state illustration.

Dark previewReplay previewOpen in new tab

Usage

Import the parts you need from the component's folder.

ts
import { Stack } from "@/components/ui/stack";

Directions

Six recede directions. The slab thickness, outline, and the hover lift-apart adapt to each angle - never hardcoded to one pose.

Dark previewReplay previewOpen in new tab
br → tl
bl → tr
tl → br
tr → bl
b → t
t → b

Layer count

Any number of layers; depth spacing and the opacity fade derive automatically.

Dark previewReplay previewOpen in new tab
2 layers
4 layers
5 layers

Size & aspect ratio

Tune the card edge with size, or pass width + aspect for non-square slabs.

Dark previewReplay previewOpen in new tab
2rem
4rem
5rem · 4/3

Per-layer content

Fill individual layers via #layer-N slots (1 = front, ascending = receding back).

Dark previewReplay previewOpen in new tab
Done

Interactive

interactive toggles the hover lift-apart. Turn it off for a purely static mark.

Dark previewReplay previewOpen in new tab
interactive (hover)
static

Entrance

The stack fades and rises in on mount. Remount to replay it.

Dark previewReplay previewOpen in new tab

In an Empty state

Composed inside Empty / EmptyMedia - the real-world usage this extracts from.

Dark previewReplay previewOpen in new tab
It's empty here

You are all caught up. New messages will land here.

API Reference

Stack

PropTypeDefaultDescription
direction"br-tl" | "bl-tr" | "tl-br" | "tr-bl" | "b-t" | "t-b""br-tl"Recede direction / pose. Front layer points toward the FROM edge, stack recedes toward the TO edge.
layersnumber3Number of stacked slabs.
gapnumber59Depth (scene-Z) spacing between adjacent layers, in px.
thicknessnumber0.5Slab side-wall depth scale (drives the box-shadow thickness).
sizestring"3rem"Card edge length (any CSS length).
widthstring—Optional non-square layer width (overrides the square size).
aspectstring—Optional layer aspect-ratio, e.g. "4 / 3".
interactivebooleantrueLift the layers apart on hover.
classstring—Merged onto the root box.
SlotDescription
defaultFront-layer content (e.g. an icon).
layer-NPer-layer content; 1 = front, ascending = receding back.