Toast
Short confirmation after an action. It appears, then leaves on its own.
Usage
import { toast, ToastRegion } from '@smartui/react';
import '@smartui/react/styles.css';When to use
- Reporting the result of an action.
- Offering undo for a few seconds.
When not to use
- Information that must stay. Use Alert.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
toast(message, options) | function | - | Call from anywhere. |
options.tone | 'neutral' | 'success' | 'warning' | 'danger' | 'neutral' | |
options.duration | number (ms) | 4000 | Danger toasts stay until dismissed. |
options.action | { label, onPress } | - | |
<ToastRegion placement> | 'bottom' | 'top-right' | 'bottom' | Mount once near the root. |
Accessibility
- Announced without moving focus.