Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Desktop Window
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Frame
- Heading
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Live Waveform
- Marker
- Menubar
- Message
- Message Scroller
- Meter
- Meter Ring
- Native Select
- Navigation Menu
- NumberCount
- Pagination
- Popover
- Progress
- Progress Ring
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Timeline
- Toast
- Toggle
- Toggle Group
- Tooltip
Compositions
Utilities
"use client"
import { Button } from "@/components/ui/button"Installation#
bunx --bun shadcn@latest add @ondo-ui/toast
Usage#
Mount Toaster once, near the root of your app.
import { Toaster } from "@/components/ui/toast"
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Toaster />
</body>
</html>
)
}Then call toast from anywhere — it is a standalone manager, so the caller does
not need to be inside the provider.
import { toast } from "@/components/ui/toast"
toast.add({
title: "Event created",
description: "Sunday, December 3 at 9:00 AM",
})Examples#
Types#
Set type to render a status icon. The built-in renderer recognizes success, info, warning, error, and loading.
"use client"
import { Button } from "@/components/ui/button"Action#
Pass button props with actionProps to render an action. toast.add returns the id, so the action can close its own toast.
const id = toast.add({
title: "Event created",
actionProps: {
children: "Undo",
onClick() {
toast.close(id)
},
},
})Promise#
Use toast.promise to move a single toast through loading, success, and error as an async task settles.
"use client"
import { Button } from "@/components/ui/button"API reference#
The component wraps Base UI Toast and accepts all of its props.
| Export | Description |
|---|---|
Toaster | Provider, portal, viewport, and the default toast list in one. Mount once. |
toast | The default toast manager — add, close, update, promise. |
createToastManager | Creates an additional manager for a separate Toaster. |
useToastManager | Reads the toasts of the nearest provider, for a custom list. |
Toast | A single toast root. |
ToastPortal, ToastProvider, ToastViewport | The pieces Toaster composes, exported for custom layouts. |
ToastContent, ToastTitle, ToastDescription | Toast body slots. |
ToastAction, ToastClose | Action and dismiss buttons. |