Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

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

PropTypeDefaultWhat it does
autoplayfalsePushes sample toasts by itself until someone presses a trigger.
duration4200How long a toast stays before it dismisses itself, in ms, 1000 to 12000.
visible3How many toasts show while the stack is folded, 1 to 5. The rest wait out of sight behind them.
peek13How much of each toast behind the front one peeks out, in px, while folded, 4 to 30.
gap10Space between toasts in px while the stack is spread out, 0 to 20.
stiffness380How firmly toasts spring into place, 150 to 800. Higher is snappier.
direction"up"Which way the stack grows: up from the bottom, or down from the top.
enableSoundtruePlays 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. 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 creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 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:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and 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}"
          }
        }
      }

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.