Animated Toast Stack

Notifications that gather into a compact stack in any of six screen positions: toasts spring in, change status in place (loading to success or error), leave with a sideways swipe or close button, and can carry an action. A useAnimatedToastStack hook handles ids, timers and promises.

Animated Toast Stack

animated-toast-stack.tsx

The base stack: neutral, info, success, error and loading toasts with icons, action buttons and swipe-away, placed top or bottom at the left, center or right, with a cap on how many stay visible.

Animated Toast Stack Animated Toast Stack preview width

Install

$ bunx --bun shadcn add @karaui/animated-toast-stack
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

Toast Promise

animated-toast-stack.tsx

Hand a promise to the hook and a single toast shows a spinner, then turns into a success or error message in the same spot once it settles, and only then starts counting down to close.

Animated Toast Stack Toast Promise preview width

Install

$ bunx --bun shadcn add @karaui/toast-promise

API Reference

useAnimatedToastStack

initialToasts?
ToastInput[]
[]
defaultDuration?
number
4200
limit?
number
—

AnimatedToastStack

toasts
AnimatedToast[]
—
onDismiss?
((id: string) => void)
—
position?
"top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center"
bottom-right
placement?
"static" | "fixed" | "absolute"
—
fixed?
boolean
false
portal?
boolean
—
portalRoot?
Element | null
—
maxVisible?
number
4
className?
string
—
classNames?
ToastClassNames
—
icons?
Partial<Record<ToastStatus, ReactNode>>
—
renderToast?
((toast: AnimatedToast) => ReactNode)
—

Updated