crea varios estilos usando import { toast } from "sonner"
toast("Event has been created.")
Here's a component that demonstrates various toast styles using the Sonner library:
The example above demonstrates various ways to use the Sonner toast library:
Basic Toast Types:
toast("Message")
toast.success("Success message")
toast.error("Error message")
toast.warning("Warning message")
toast.info("Info message")
Custom Styling:
toast("Message", { style: { backgroundColor: "#4b0082", color: "white" } })
toast("Message", { icon: "🚀" })
toast("Message", { duration: 5000 })
(5 seconds)Interactive Toasts:
toast("Message", { action: { label: "Yes", onClick: () => {} } })
const toastId = toast.loading("Loading..."); toast.success("Done!", { id: toastId })
Position Variants:
toast("Message", { position: "top-center" })
Make sure to include the <Toaster />
component in your layout for the toasts to appear.