Display an important message globally.
Basic usage.
Display multiline or overlong text.
Add a custom button to the Toast.
Use passive
to change the style of the button.
useToasts
const [toasts: Array<Toast>, setToast: (toast: Toast) => void] = useToasts()
Toast
interface Toast {
text?: string
type?: NormalTypes
delay?: number
actions?: Array<ToastAction>
}
ToastAction
interface ToastAction {
name: string
handler: (event: React.MouseEventHandler<HTMLButtonElement>, cancel: () => void) => void
passive?: boolean
}
NormalTypes
type NormalTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error'