Skip to content
GitHub

Toast

Preview solid
Terminal window
npx shadcn@latest add https://devx-op.github.io/arkitect-ui/r/s/toast.json

The Toast component uses Ark UI’s toast primitive. You need to render the Toaster component in your app root and use the toast function to display notifications.

import { Toaster, toast } from "@/components/ui/toast"
function App() {
return (
<>
<Toaster />
<button onClick={() => toast("Hello world")}>Show toast</button>
</>
)
}

The toast function accepts either a string or an object:

// Simple usage
toast("Event created")
// With options
toast({
title: "Event created",
description: "Your event has been saved successfully",
type: "success", // "info" | "success" | "error" | "warning"
duration: 5000,
})
toast.success("Operation successful")
toast.error("Something went wrong")
toast.warning("Please review your input")
toast.info("New update available")
toast.dismiss() // Dismiss all toasts
toast.dismiss(id) // Dismiss specific toast