Skip to content

Stack

Free

A pile of any items: the front item whole and the rest peeking out behind it. It opens into a full list on hover, focus, tap, or a button.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 10, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Put each item in a StackItem with a key, and add a trigger to open the pile.

notifications.tsx

Stack

<div>
PropTypeDefaultDescription
direction"down""end""start""up""up"
variant"fan""stack""stack"
peeknumber8How many px of each item behind shows past the item in front of it. Default 8.
scaleStepnumber0.05How much smaller each item behind is: item n scales by 1 − scaleStep × n. Default 0.05.
maxVisiblenumber3The most items that show while collapsed, the front one included. Default 3.
gapnumber8The px between two items while expanded (stack variant). Default 8.
fanAnglenumber3fan: the degrees each item behind turns while collapsed, to alternate sides. Default 3.
fanSpreadnumber12fan: the degrees between two cards of the spread hand while expanded. Default 12.
expandOn"always""click""hover""hover"hover (default): expands while the pointer is over the list or focus is inside it, and on a tap on a touch screen (a tap outside collapses it). click: only a StackTrigger (or the expanded prop) expands it. always: always expanded. Escape collapses an expanded stack.
expandedboolean—The expanded state, controlled.
defaultExpandedbooleanfalseThe expanded state at the start, uncontrolled. Default false.
onExpandedChange—
indexnumber—The child index of the front item, controlled. StackNext and StackPrevious change it.
defaultIndexnumber0The child index of the front item at the start, uncontrolled. Default 0 (the first child).
onIndexChange—Gets the new front index, wrapped into 0 … count − 1.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

StackList

<ul>
PropTypeDefaultDescription
...props<ul> attributes—Every other attribute goes to the <ul>, with a ref.

StackItem

<li>
PropTypeDefaultDescription
...props<li> attributes—Every other attribute goes to the <li>, with a ref.

StackTrigger

<button>
PropTypeDefaultDescription
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs""sm"
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary""ghost"
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

StackNext

<button>
PropTypeDefaultDescription
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs""icon-sm"
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary""outline"
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

StackPrevious

<button>
PropTypeDefaultDescription
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs""icon-sm"
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary""outline"
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.
  • Put each item in a StackItem with a key. The first child is the front item.
  • Give each item its own surface (a Card, a bordered box): the item draws nothing.
  • Use expandOn="click" with a StackTrigger when the pile should open only on a press.
  • Add StackNext and StackPrevious to bring another item to the front.
  • Use variant="fan" for photos or cards that should turn and spread.
  • For slides that a reader swipes through side by side, use Carousel.
  • For cards that pin one after another as the page scrolls, use Sticky Card Stack.
  • For a pile where each card is a yes or no choice, use Swipe Deck.
TabMove the focus onto the pile: with hover, the pile opens.
Enter / SpaceOn a StackTrigger, open or close the pile. On StackNext or StackPrevious, bring another item to the front.
EscapeClose an open pile.

The pile is a list. While it is closed, the items behind the front one are inert: out of the tab order and hidden from screen readers.

StackTrigger sets aria-expanded and aria-controls. StackNext and StackPrevious have names ("Show next item", "Show previous item"); translate them with aria-label.

Open and close
toast · the items move apart or back together, and the list grows or shrinks on the same clock (300ms)
Cycle
toast · the front item goes to the back and the next one comes forward
Add
toast · a new item comes in from past the anchor edge and fades in
Remove
toast-exit · a removed item leaves past the anchor edge and fades out (150ms)

Built with

Installs with Stack

Components
Button
  1. AddedStack, with Button.
Open the release