Notification Stack
Stacked toast notifications with auto-dismiss progress, sliding animations, and multiple types.
npx uniqueui add notification-stack
Preview
Usage
"use client";
import { NotificationStack, useNotifications } from "@/components/ui/notification-stack";
export default function Example() {
const { notifications, addNotification, removeNotification } = useNotifications();
return (
<div className="flex flex-col items-center gap-4 w-full p-20">
<div className="flex flex-wrap gap-3 items-center justify-center">
{(["success", "error", "warning", "info"] as const).map((type) => (
<button
key={type}
onClick={() =>
addNotification({
title: `${type.charAt(0).toUpperCase() + type.slice(1)} notification`,
description: "This is a demo notification that auto-dismisses.",
type,
duration: 4000,
})
}
className="px-4 py-2 rounded-lg text-sm font-medium transition-colors capitalize text-white bg-neutral-800 hover:bg-neutral-700"
>
{type}
</button>
))}
</div>
<NotificationStack notifications={notifications} onRemove={removeNotification} />
</div>
);
}Props
| Prop | Type | Description |
|---|---|---|
className | string | CSS attributes tailoring the absolute container. |
position | "top-right" | "top-left" | "bottom-right" | "bottom-left" | Screen coordinate literal dictating orientation constraints. |
maxVisible | number | Limit quantity threshold managing physical screen stack instances. |