# Notification stack

Dismissible messages with optional actions and timers.

Access: pro. Category: Feedback. Kind: composite.

## When to use

- Use it when a page needs dismissible messages with optional actions and timers.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose notification-center instead when use the center for a persistent, browsable notification history rather than transient toasts.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Notification stack

```sh
npx shadcn@latest add @tidal-pro/notification-stack
```

Stylesheets: `components/ui/tidal.css`, `components/ui/notification-stack.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/notification-stack.css";
import{TidalNotificationStack}from"./components/ui/notification-stack";
export default()=><div className="tidal-scope"><TidalNotificationStack notifications={[{id:"example",title:"Demo"}]} onDismiss={() => {}}/></div>;
```

## Structured props

- `TidalNotificationStack.notifications: Array<TidalNotification>`: Required notifications value accepted by this exported component.
- `TidalNotificationStack.onDismiss: (id: string) => void`: Callback invoked when the dismiss interaction is proposed.
- `TidalNotificationStack.className?: string | undefined` (default ""): Optional class name value accepted by this exported component.
- `TidalNotificationStack.position?: "inline" | "bottom-right" | undefined` (default "inline"): Optional position value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/notification-stack.tsx) | [Manifest](https://tidalui.com/examples/notification-stack.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState, useRef } from "react";

import { Plus } from "lucide-react";

import { TidalNotificationStack, type TidalNotification } from "./components/ui/notification-stack";

import "./components/ui/notification-stack.css";

import { TidalButton } from "./components/ui/tidal-button";



const tidalExampleStyles = ".demo-footnote{font-size:11px;color:var(--t-muted);margin-top:12px}\n\n.notifications-specimen{width:100%;max-width:350px}.notifications-specimen>.tidal-button{display:flex;margin:17px auto 0;font-size:11px}.notifications-specimen>.demo-footnote{text-align:center;font-size:11px}";

export function NotificationDemo() {
  const [notifications, setNotifications] = useState<TidalNotification[]>([
    {
      id: "welcome",
      title: "Workspace ready",
      description: "The sample workspace is ready.",
      tone: "success",
    },
    {
      id: "invite",
      title: "Teammate invited",
      description: "The sample teammate was added to the project.",
      tone: "info",
    },
  ]);
  const count = useRef(0);
  return (
    <div className="notifications-specimen">
      <TidalNotificationStack
        notifications={notifications}
        onDismiss={(id) =>
          setNotifications((items) => items.filter((item) => item.id !== id))
        }
      />
      <TidalButton
        variant="secondary"
        onClick={() => {
          count.current += 1;
          const id = "new-" + count.current;
          const next: TidalNotification = {
            id,
            title: "Changes saved",
            description: "The local sample was updated.",
            tone: "success",
          };
          setNotifications((items) => [...items, next].slice(-3));
        }}
      >
        <Plus size={14} aria-hidden="true" />
        Show a notification
      </TidalButton>
      <p className="demo-footnote">
        Dismiss one. Add another. Press F8 to focus.
      </p>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <NotificationDemo />
    </div>
  );
}

```

## Gotchas

- Use this for transient feedback; retained notification history belongs in notification-center or notification-inbox.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"The implementation includes reduced-motion behavior; verify it with the consumer's final content."}

notifications: unique fresh id per message, title, description?, tone (success|info|error)?, duration?, action {label,altText,onClick}?. onDismiss required. Optional inline/bottom-right position, className. Persistent by default; positive finite duration in milliseconds enables timed dismissal; Infinity persists. Radix pauses timer on focus/hover/blur, supports swipe and F8 focus. Mount one stack per application.
