API reference: @salmonui/notifications/toast
ToastStateinterface
import type { ToastState } from '@salmonui/notifications/toast';interface ToastState extends ToastOptions {
readonly id: string;
readonly closing: boolean;
readonly run: number;
}
A toast in the queue: its options plus store state.
| Name | Signature | Description |
|---|---|---|
id | readonly id: string; | Stable id returned by |
closing | readonly closing: boolean; | True during the exit transition. |
run | readonly run: number; | Increments when the timer restarts (an update of |
titleoptionalinherited | title?: ReactNode; | Heading line. |
descriptionoptionalinherited | description?: ReactNode; | Body text under the title. |
contentoptionalinherited | content?: ReactNode; | Replaces the default layout (icon, title, description, actions). |
toneoptionalinherited | tone?: ToastTone; | Color role; |
iconoptionalinherited | icon?: ReactNode; | Replaces the built-in tone icon; |
durationoptionalinherited | duration?: number; | Time on screen in ms. Default 5000, or |
dismissibleoptionalinherited | dismissible?: boolean; | Shows a close button; Escape on the focused toast also closes it. Default |
progressoptionalinherited | progress?: boolean; | Shows the countdown bar (a CSS animation paused with the timer). |
actionsoptionalinherited | actions?: readonly ToastAction[]; | Buttons in the toast. |
classNameoptionalinherited | className?: string; | Extra class on the toast element. |
styleoptionalinherited | style?: CSSProperties; | Inline style on the toast element, for example a width. |
onOpenoptionalinherited | onOpen?: ((id: string) => void); | Called when the toast enters the visible stack. |
onBeforeCloseoptionalinherited | onBeforeClose?: ((event: ToastBeforeCloseEvent) => void); | Called before the toast closes; |
onCloseoptionalinherited | onClose?: ((event: ToastCloseEvent) => void); | Called when the toast closes, with the reason. |
onClickoptionalinherited | onClick?: ((event: MouseEvent<HTMLElement, MouseEvent>) => void); | Called on a click anywhere in the toast. |