Getting Started
UI Library
- Button
- Date Picker
- Field
- Fields
- Input Group
- File Uploader
- Signature Pad
- Text Area
- Container
- Section Header
- Separator
- Spacer
- Action Row
- Breadcrumb
- Tabs
- Tabs Container
- Card
- Image
- Text
- Title
- Video Player
- Card Collection
- Data Grid
- List Collection
- Table Collection
- Bar Chart
- Big Number
- Line Chart
- Radial Chart
- Hint
- Progress
- Spinner
- Skeleton
- Toast
- Sheet
- Dialog
- Real-world patterns
- Primitives
Toasts are brief, dismissible notifications that appear without interrupting the user's workflow.
Setup
Add <Toaster /> once in your app's root layout:
import { Toaster } from "@pex/ui-web/feedback/toast";
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
{children}
<Toaster position="top-center" />
</body>
</html>
);
}Basic Usage
Types
With Description
With Action
API Reference
Toaster Props
| Prop | Type | Default | Description |
|---|---|---|---|
position | "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "bottom-right" | Where toasts appear on screen |
duration | number | 4000 | Auto-dismiss duration in milliseconds |
richColors | boolean | false | Use richer semantic colors for success/error/warning |
closeButton | boolean | false | Show a close button on each toast |
toast()
toast(message: string, options?: ToastOptions)
toast.success(message, options?)
toast.error(message, options?)
toast.warning(message, options?)
toast.info(message, options?)
toast.promise(promise, { loading, success, error })
toast.dismiss(toastId?)See the Sonner docs for the full API.