Toast
A succinct message displayed temporarily to provide feedback about an operation.
toast.tsx
Core implementation of the Toast component.
ReactSonnerTailwindOverlays
"use client";
import * as React from "react";
import { Toaster as SonnerToaster, toast } from "sonner";
export interface ToastProps {
theme?: "light" | "dark" | "system";
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center";
}
export function Toast({ theme = "system", position = "bottom-right" }: ToastProps) {
return (
<SonnerToaster
theme={theme}
position={position}
toastOptions={{
className:
"rounded-2xl border border-border bg-background text-foreground shadow-lg font-sans text-xs",
}}
/>
);
}
export { toast };Basic Usage
Toast notifications.
API Reference
Props — Toast
Properties to configure the Toast component.
| Prop | Type | Default | Description |
|---|---|---|---|
| position | string | 'bottom-right' | Screen position where toast popups appear. |