Notifications
A comprehensive toast notification system with themes, stacking, animations, and programmatic control.
Examples
"use client";
import { Button, useNotification } from "@g4rcez/components";
const themes = [
"default",
"info",
"warn",
"muted",
"danger",
"success",
"secondary",
] as const;
function NotificationThemesDemo() {
const notify = useNotification();
return (
<div className="flex flex-wrap gap-2">
{themes.map((theme) => (
<Button
key={theme}
onClick={() =>
notify(`This is a ${theme} notification`, {
title: `${theme.charAt(0).toUpperCase() + theme.slice(1)} Notification`,
theme: theme,
})
}
>
Trigger {theme}
</Button>
))}
</div>
);
}When to use Notifications
Use when
You need the documented Notifications interaction or presentation in a product workflow.
Avoid when
A native HTML element already provides the Notifications behavior you need.
Accessibility
Keep the Notifications labeled and use its documented keyboard interaction. The component preserves visible focus and communicates state without relying on color alone.
- Keep keyboard focus visible and follow the documented key commands.
- Provide an accessible name and connect descriptions or errors to the control.