fetaUI
GitHub

Toast

A short message that melts from a pill into a card. Eight kinds, with stacking and swipe.

FreeWeb and Mobile8 variantsMotion

Preview

npx shadcn add @fetaui/toast
Playground
Press F6 to reach notifications
    Live
    Collapsed
    Changes saved
    Storage almost full
    New version ready
    Uploading files34%
    File uploaded
    Message archived
    Exporting report64%
    Expanded
    Changes saved

    Changes saved to the database. Refresh to see them.

    Storage almost full

    You have used 92% of your space. Upgrade to keep syncing.

    New version ready

    Version 2.4 is available. Reload when you are ready.

    Uploading files

    Keep this tab open while 3 files upload.

    2 OF 3
    File uploaded

    Your file is ready. Share it with your team?

    Message archived

    Moved to Archive with 2 replies.

    5S
    Exporting report

    1,240 of 1,940 rows written.

    64%
    Message
    Changes saved

    Changes saved successfully to the database. Please refresh the page to see the changes.

    Storage almost full

    You’ve used 95% of your available storage. Please upgrade your plan to continue.

    New version ready

    Version 2.0 is now available. Please update your app to continue using the latest features.

    Uploading files

    Keep this tab open while your 3 files finish uploading.

    File uploaded

    Your file has been uploaded and is ready to share with your team.

    Message archived

    The conversation moved to Archive with its 2 replies.

    Exporting report

    Your report is being written. We will email you when it is ready.

    Kind
    Position
    Icons animation
    Motion

    Installation

    Terminal· bash
     npx shadcn add @fetaui/toast
    

    Accessibility

    • A polite live region, with errors assertive.
    • Actions are real buttons.
    • Timers pause on hover and focus.

    Motion

    • The pill drops in over 240 ms, then the tray melts out on a 600 ms spring after 150 ms.
    • It collapses 2 s before a 6 s timeout. Undo counts down from 5 s.
    • Older toasts scale down and rise on a spring, peeking 38 and 74 px.
    • With reduced motion, shapes crossfade, stacks jump and Undo shows only mono seconds.

    Responsive behavior

    • 360 px on Web and 358 px on Mobile, with a 44 px tab.
    • Swipe sideways past 40% to dismiss on touch.

    Performance

    • Toasts live in a small external store read with useSyncExternalStore, so only the Toaster re-renders when one is added.
    • At most three show. Older ones stack behind them with opacity 0 and stay mounted until they time out.
    • Each toast measures its height with one ResizeObserver, disconnected on unmount.

    Note for AI

    Give your coding assistant the Markdown reference instead of screenshots.

    • Render <Toaster /> once near the root, then call toast({ kind, title, description, action, cancel, progress, meta, duration }). It returns an id.
    • toast.update(id, patch), toast.dismiss(id) and toast.promise(work, { title, success, error }) handle the rest.
    • Loading and Promise stay until updated. Undo closes after 5 s, the others after 6 s. Hover and focus pause the timers.
    • The Toast component alone is for previews. The demo's action handlers do nothing.

    Related