ui
ui copied to clipboard
Add a promise toast
I usually use react-hot-toast, there are quite some cool features, for example, you can call the toast, without using useToast. Another main reason is toast can embed the promise, useful for "Loading", "Success", or "Error" states.
It would be really nice, I also has faced it
Maybe not relevant but if you want toast within the same style I use library called sonner like this
"use client";
import { Toaster as RadToaster } from "sonner";
export function Toaster() {
return (
<RadToaster
position="bottom-right"
toastOptions={{
style: {
background: "hsl(var(--background))",
color: "hsl(var(--foreground))",
border: "1px solid hsl(var(--border))",
},
}}
/>
);
}
Sonner has been added to shadcn, this can be closed.