Toast

Toast is used to show message on top of an overlay to update that users the status of system.

Notification

Notification pop up with toast

Notification Type

Indicate type of Notification will show corresponded icon & colors, type can be 'info', 'warning', 'error', or 'success'.

Custom icon

Then icon in Notification can be replaced by any element.

Placement

Toast placement can be assign around the trigger element in different positions, there are 6 placement options available.

Closable

Enable closable prop to show close icon in Notification

Alert

Toast can also use with Alert.

Duration

Setting duration prop on Notification to specify the duration of open, toast will never dismiss if duration value is 0.

CustomClose

toast.push() will return a uid of notification instance, we can pass this uid to toast.remove(uid) method to remove the corresponded notification.

API

toast
MethodDescription
toast.push(message: ReactNode, options?: ToastProps): stringMethod to pop a toast message, it will return a UID for the current toast
toast.remove(key: string): voidMethod to remove a specify toast message by using the key from push method
toast.removeAll(): voidMethod to remove all toast message
ToastProps
PropDescriptionTypeDefault
blockWhether to display toast in full widthbooleanfalse
offsetXOffset X of toastnumber30
offsetYOffset Y of toastnumber30
placementPlacement of toast'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end''top-end'
transitionTypeTransition type of animation'scale' | 'fade''scale'
Notification
PropDescriptionTypeDefault
closableWhether to show close iconbooleanfalse
customIconCustom element beside Notification contentReactNode | string-
durationTime in seconds before Notification dismiss, it will never dismiss if duration value is 0number3000
onCloseCallback when Notification is closed(e: MouseEvent) => void-
titleTitle of Notificationstring-
typeType of Notification'info' | 'warning' | 'success' | 'danger'-
widthWidth of Notificationnumber | string350