Toast Stack

Overview

Stacked toasts with status morphs, swipe to dismiss, actions and layout-aware motion.

This feedback component is intended for interfaces that need stacked toasts with status morphs, swipe to dismiss, actions and layout-aware motion, form workflows, and support tools. Its implementation is provided as editable source so the final behavior and styling stay inside your project.

Technologies

React
TypeScript
Tailwind CSS
Motion

Detected package dependencies: motion, clsx, tailwind-merge, lucide-react.

@spectrumui/toast-stack

    Toasts stack, morph between statuses and swipe away.

    Installation

    Login to view commandCreate a free account to access the install command

    Usage

    import { AnimatedToastStack, useAnimatedToastStack } from "@/components/motion/animated-toast-stack"
    const { toasts, showToast, updateToast, dismissToast } = useAnimatedToastStack()
    
    const id = showToast({ status: "loading", title: "Deploying…", duration: 0 })
    updateToast(id, { status: "success", title: "Deployed" })
    
    <AnimatedToastStack toasts={toasts} onDismiss={dismissToast} position="bottom-right" />

    API Reference

    AnimatedToastStack

    beUI's Animated Toast Stack (beui.dev, MIT), installed from its shadcn registry into components/motion. Pair it with the useAnimatedToastStack hook, which returns toasts plus showToast, updateToast, dismissToast and clearToasts. A toast can morph from loading to success or error in place.

    PropTypeDefaultDescription
    *toastsAnimatedToast[]-Toasts to render, from the hook
    onDismiss(id: string) => void-Fires when a toast is swiped or closed
    positionToastPosition"bottom-right"Corner or edge to stack from
    placement"static" | "fixed" | "absolute"-static renders inline; fixed floats over the page
    portalboolean-Render into a portal (defaults to true when fixed)
    maxVisiblenumber-How many toasts show before older ones collapse
    iconsPartial<Record<ToastStatus, ReactNode>>-Override the status icons
    renderToast(toast: AnimatedToast) => ReactNode-Fully custom toast renderer
    classNamestring-Classes for the stack

    useAnimatedToastStack

    Owns the toast list and auto-dismiss timers.

    PropTypeDefaultDescription
    initialToastsToastInput[]-Toasts present on mount
    defaultDurationnumber4200Auto-dismiss in ms; a toast with duration 0 stays
    limitnumber-Maximum toasts kept in the list

    Use cases

    • interfaces that need stacked toasts with status morphs, swipe to dismiss, actions and layout-aware motion
    • form workflows
    • support tools

    Features

    • Copy-paste source that remains in your repository
    • TypeScript source included with the component
    • Tailwind CSS classes editable in the component source
    • Animation implemented with Motion
    • Reduced-motion handling present in the source

    Accessibility

    • The source includes ARIA attributes or roles; preserve them when customizing the component.
    • The source checks reduced-motion preferences or includes motion-reduce styles.
    • Test focus order, keyboard operation, labels, contrast, and screen-reader output in the final application context.

    Customization

    • Edit the Tailwind utility classes in the copied source to match your spacing, color, and typography tokens.
    • Use the documented className surface for local layout adjustments, then edit the source for structural changes.
    • Adjust Motion transitions in the source and keep the reduced-motion behavior aligned with the final interaction.

    Toast Stack FAQ

    Is Toast Stack free to use in commercial projects?

    Yes. The public Toast Stack source is available under the Apache License 2.0, including for commercial use, subject to the LICENSE terms.

    How do I install Toast Stack?

    Run npx shadcn@latest add @spectrumui/toast-stack. The page also exposes the source for manual installation.

    Does Toast Stack require Motion?

    Yes. Motion usage was detected in the documented source or registry dependencies for Toast Stack.

    Does Toast Stack use shadcn/ui or Radix UI?

    No shadcn/ui or Radix UI dependency was detected in the documented Toast Stack source.

    Can I use Toast Stack in Next.js?

    The documented React source is used in this Next.js application. Keep its use client directive when copying it into the App Router. Install the detected dependencies and verify any application-specific data or image configuration.

    What accessibility checks should I run for Toast Stack?

    The source includes ARIA markup, reduced-motion handling. Test the finished interface with keyboard and screen-reader workflows.

    Work with me