Notification Stack, animated React component
Toasts that pile into a neat stack, spread out while hovered (pausing their timers), swipe away sideways, and turn a loading toast into a success when the work finishes.
- Pro
- Cards
- Hover
- Spring
Pings when you press a trigger and a toast arrives. Sound is off on this site until you switch it on.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| autoplay | boolean | false | Pushes sample toasts by itself until someone presses a trigger. |
| duration | number | 4200 | How long a toast stays before it dismisses itself, in ms, 1000 to 12000. |
| visible | number | 3 | How many toasts show while the stack is folded, 1 to 5. The rest wait out of sight behind them. |
| peek | number | 13 | How much of each toast behind the front one peeks out, in px, while folded, 4 to 30. |
| gap | number | 10 | Space between toasts in px while the stack is spread out, 0 to 20. |
| stiffness | number | 380 | How firmly toasts spring into place, 150 to 800. Higher is snappier. |
| direction | "up" | "down" | "up" | Which way the stack grows: up from the bottom, or down from the top. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Notification Stack is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
Notification Stack questions
How do I install the Notification Stack?
Run `npx shadcn@latest add @nexus-labs/notification-stack`. It depends on framer-motion and uses no canvas; the stacking, spreading and swiping are all Framer Motion springs on list items. It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
Is this a toast library I can call from anywhere in my app?
No. It is a self-contained component that shows four sample toasts (success, error, info and a loading one) from its own buttons, and it exports no function for pushing toasts from other code. Treat it as a design to adapt: its props are `autoplay`, `duration`, `visible`, `peek`, `gap`, `stiffness`, `direction` and `enableSound`.
How do I change how long toasts stay and how the stack looks?
`duration` is how long a toast stays in ms (default 4200, clamped 1000 to 12000), `visible` is how many show while the stack is folded (default 3, 1 to 5), `peek` is how many px of each toast behind the front one shows (default 13) and `gap` is the spacing when spread out (default 10). `direction="down"` grows the stack from the top instead of the bottom.
How do hover, swipe and the loading toast behave?
Hovering the stack spreads it out and pauses the auto-dismiss timers, which restart when the pointer leaves. Dragging a toast sideways more than 90px dismisses it, each toast also has a Dismiss button, and the list is an `aria-live="polite"` region. The loading toast turns into a "Published" success after 1.8 seconds.
Does it make sound, and how do I turn it off?
Pings when you press a trigger and a toast arrives. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.