Skip to content

No.461 · Feedback

Toast Stack

Notifications that stack like a hand of cards and fan out into a readable list on hover, pausing every timer.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

The design brief behind this component — reuse it to regenerate, remix, or explain it.

Design a toast system where the pile is the interface. Toasts are 14px-rounded dark plum cards with a hairline border, blur, and a deep shadow, each with a round status icon (info, success, error), a title, optional body, a dismiss button, and a 2px countdown hairline along the bottom edge that shrinks as its time runs out. Stacking: all toasts are absolutely positioned at the bottom-right. The newest is at index 0 in front; each older one is offset up 0.7rem, scaled down 5.5% and faded 18%, anchored at the bottom centre, so the pile reads like cards in a hand. New toasts rise in (420ms, ease-out-expo). Hovering or focusing anywhere in the region fans the stack into a list — each toast moves up by its own height plus a gap and returns to full scale and opacity — and pauses every countdown; leaving resumes them. Dismissed toasts slide right and fade. At most four are visible; extras wait invisibly behind. Provide a provider + useToast() hook. The container is an aria-live="polite" region; each toast uses role="status", or role="alert" for errors. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Hover/focus the pile to fan it out and pause timers; click ✕ or wait to dismiss. Motion: Enter 420ms ease-out-expo; stack ↔ fan 420ms; dismiss 320ms; countdown per frame. Accessibility: aria-live polite region; role=status/alert per toast; dismiss buttons are labelled with the toast title; focus inside the region also fans and pauses. Reduced motion removes the animations. Responsive behavior: Width min(22rem, 100% − 2rem), anchored to the bottom-right of its positioned container. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Hover/focus the pile to fan it out and pause timers; click ✕ or wait to dismiss.
Motion
Enter 420ms ease-out-expo; stack ↔ fan 420ms; dismiss 320ms; countdown per frame.
Accessibility
aria-live polite region; role=status/alert per toast; dismiss buttons are labelled with the toast title; focus inside the region also fans and pauses. Reduced motion removes the animations.
Responsive
Width min(22rem, 100% − 2rem), anchored to the bottom-right of its positioned container.