Toast
Version - 0.0.7A succinct message that is displayed temporarily.
Installation
npm install @volta/toastUsage
Add the Toaster component to your Application
import { Toaster } from '@volta/toast';
export default function RootLayout({ children }) {
return (
<html lang="en">
<head />
<body>
<main>{children}</main>
<Toaster />
</body>
</html>
);
}The useToast hook returns a toast function that you can use to display a toast.
import { Button } from '@volta/button';
import { useToast } from '@volta/toast';export default function ToastDemo() {
const { toast } = useToast();
return (
<Button
variant="outline"
onClick={() => {
console.log(
toast({
title: 'Toast title',
description: 'This is a toast.',
})
);
}}
>
Show Toast
</Button>
);
}