Toast
A customizable and responsive toast notification system.
Installation
npx shadcn@latest add https://scrollxui.dev/registry/toast.json
Usage
//First, wrap your application with the ToastProvider:
import { ToastProvider } from "@/components/ui/toast";
function App() {
return (
<ToastProvider>
<YourApp />
</ToastProvider>
);
}
import { useToast } from "@/components/ui/toast";
return function MyComponent() {
const { toast } = useToast();
const showToast = () => {
toast({
title: "Success!",
description: "Your action was completed successfully.",
variant: "success",
});
}
}
Examples
Default
Warning
Error
Delete
Info
Success
With Action
Persistent
Promise
Rich Content
Custom Duration
Bulk Actions
API Reference
toast
Triggers a toast notification.