Skip to main content

Toaster

Component responsible for displaying all of the toast notifications. Can be positioned anywhere within application.

info

It is recommended to have only one Toaster component in the application.

info

When a toast is created, it inherits options from the Toaster, but the toast's own options will override the Toaster's properties.

info

visibleToasts option is available only for the Toaster component.

TitleDescriptionTypeDefault
visibleToastsMaximum number of visible toasts at once. 0 equals no limit.number0
messageThe main content or message displayed in the toast.stringHave a good day 🙂
titleThe title of the toast, displayed above the title. First word will be capitalized.stringbase
positionDefines where the toast will appear on the screen.ToastPositionbottom-right
typeSpecifies the type of toast (e.g., success, error).ToastTypebase
orderDetermines the display order of the toast.DisplayOrdernormal
inAnimationAnimation applied when the toast appears.ToastInAnimationslideVerticallyIn
outAnimationAnimation applied when the toast disappears.ToastOutAnimationslideHorizontalWithFadeInBody
inBodyAnimationAnimation for the toast body when it appears.ToastInBodyAnimationslideVerticallyOut
hideOnClickIf true, the toast hides when clicked.booleantrue
autoHideDuration before the toast automatically hides.number3000
delayBeforeShowDelay before the toast is shown.number0
showProgressIf true, displays a progress bar indicating remaining time.booleantrue
showIconIf true, shows an icon in the toast.booleantrue
showHideButtonIf true, shows a button to manually hide the toast.booleantrue
animateBodyIf true, the body of the toast will have animation.booleantrue
rtlIf true, displays the toast in right-to-left layout.booleanfalse
pauseOnHoverIf true, pauses auto-hide timer when the toast is hovered.booleantrue
pauseOnFocusLossIf true, pauses auto-hide timer when window loses focus.booleantrue
dragOnMobileIf true, the toast can be dragged on mobile devices.booleantrue
removeOnDraggingPercentPercentage of drag distance on mobile before removal.number70
themeSpecifies the theme className of the toast.ToastTheme""
iconClassNameCustom class name for the icon.string""
hideButtonClassNameCustom class name for the hide button.string""
contentClassNameCustom class name for the toast content.string""
containerClassNameCustom class name for the toast container.string""
bodyClassNameCustom class name for the toast body.string""
progressBarClassNameCustom class name for the progress bar.string""
classNameCustom class name for the entire toast.string""
roleARIA role attribute for accessibility.stringalert
iconStyleCustom CSS styles for the icon.CSS.Properties<string | number>{}
hideButtonStyleCustom CSS styles for the hide button.CSS.Properties<string | number>{}
contentStyleCustom CSS styles for the toast content.CSS.Properties<string | number>{}
containerStyleCustom CSS styles for the toast container.CSS.Properties<string | number>{}
bodyStyleCustom CSS styles for the toast body.CSS.Properties<string | number>{}
progressBarStyleCustom CSS styles for the progress bar.CSS.Properties<string | number>{}
styleCustom CSS styles for the entire toast.CSS.Properties<string | number>{}
onShowingCallback function triggered when the toast starts to show.ToastCallbackundefined
onHidingCallback function triggered when the toast starts to hide.ToastCallbackundefined
onShowCallback function triggered when the toast is fully shown.ToastCallbackundefined
onHideCallback function triggered when the toast is fully hidden.ToastCallbackundefined
onClickCallback function triggered when the toast is clicked.ToastCallbackundefined

Example

<Toaster
visibleToasts={5}
position={availablePosition}
type="success"
title="Congrats!"
order="normal"
inAnimation={zoomIn}
outAnimation={singleBounceHorizontallyOut}
inBodyAnimation={slideHorizontalWithFadeInBody}
autoHide={5000}
theme="toastup__toast-theme--colorful"
hideOnClick
showProgress
showIcon
showHideButton={false}
animateBody
rtl={false}
pauseOnHover
dragOnMobile
/>