Toast Stack
Stacked toast notifications with a one-line toast() API, success, error, info, loading and promise states, actions, hover-to-expand, and pausing timers.
Overview
About the Toast Stack
Stacked toast notifications with a one-line toast() API, success, error, info, loading and promise states, actions, hover-to-expand, and pausing timers. It is delivered as editable TypeScript for React. Tailwind CSS is not required; the component's visual CSS is embedded in its TypeScript source. Its focused API can be adapted to your own content and visual system.
Usage
When to use it
- Confirming saves, deletes, and uploads anywhere in a product without blocking the user.
- Long-running actions that should show loading, then success or failure.
What’s included
Files in the product ZIP
Toast Stack source
components/toast-stack.tsxEditable React and TypeScript component source.
Working example
examples/example.tsxA minimal import and render example that matches the packaged API.
Installation guide
README.mdManual ZIP installation, styling, compatibility, asset, and usage notes.
Usage
Import and render
Copy the packaged source to the documented path, then use the public API shown below.
import { Toaster, toast } from "@/components/toast-stack";export default function App() {
return (
<>
<button onClick={() => toast.success("Changes saved")}>Save</button>
<Toaster position="bottom-right" />
</>
);
}Props
Component API
| Prop | Type | Default | Description |
|---|---|---|---|
| position | "bottom-right" | "bottom-center" | "bottom-left" | "top-right" | "top-center" | "top-left" | "bottom-right" | Corner where the stack is anchored. |
| visibleToasts | number | 3 | How many toasts stay visible in the stack. |
| expand | boolean | false | Keep the stack expanded instead of only on hover. |
| strategy | "fixed" | "absolute" | "fixed" | Use absolute to contain the stack inside a positioned parent. |
| store | ToastStore | default store | Custom store from createToastStore(). |
| className | string | "" | Additional root class names. |
toast(title, { description, type, duration, action, id }) returns an id. Use toast.dismiss(id) to close one, or createToastStore() for an isolated instance passed to <Toaster store={...} />.
Compatibility
Verified project setup
- ReactLoom's preview is tested with Next.js 16.3.8 App Router, React 19.2.8, TypeScript 5.9.3, and Tailwind CSS 4.3.3. This describes the store environment, not the product's minimum requirements.
- This interactive component includes the "use client" directive and must remain behind a Client Component boundary in the Next.js App Router.
- Tailwind CSS is not required; the component's visual CSS is embedded in its TypeScript source.
- Images
- No image files are included or required by the packaged component.
- Fonts
- No font files are included. The component uses system font fallbacks unless your app supplies a matching font.
Installation
Add it to your project
Download the Toast Stack ZIP, place the source file at src/components/toast-stack.tsx, and copy the example into your own page or feature folder.
Target path
src/components/toast-stack.tsxNo additional npm runtime packages are required beyond the React host; follow the styling requirements below.
Styling requirements
- Tailwind CSS is not required by this component.
- All component styles are embedded in components/toast-stack.tsx.