Feedback
useToast
Display temporary notifications and alerts to users with customizable styling.
import { useToast } from "saha-ui"Uses
Toast manager for showing temporary notifications with configurable content, type, duration and actions.
Props
| Name | Type | Description | Default |
|---|---|---|---|
| options (for each toast) | { title?: string; description?: string; type?: 'info' | 'success' | 'warning' | 'error'; duration?: number; onClose?: () => void } | Configuration object for a toast: content, style and behavior. | - |
Returns
| Name | Description |
|---|---|
| show(toastOptions) | Show a toast with the given options. |
| dismiss(id) | Dismiss a toast programmatically by id. |
Example
const toast = useToast();
toast.show({ title: 'Saved', description: 'Your changes were saved', duration: 4000, type: 'success' });Notes
Intended to be used with a provider + hook combo that queues and renders toasts.