Toast

Toasts can be dismissed and sit on top of a view in various position options - top/right, top/center, top/left, bottom/right, bottom/center, bottom/left. Toasts are intended to provide feedback to a user and self-dismiss after a short time with an option to self-dismiss. Each toast can be colored to fit it’s status type of neutral, positive, warning and alert.

Accessibility

  • Toast notification container element has role="alert" set on it.
  • When multiple alerts are displayed and positioned relative to the browser window they won't overlap but displayed in a column way, latest notifications are displayed at the initial position of a chosen placement
  • When a notification is set to be dismissed automatically after a provided autoHideDuration time hovering or focusing the notification will prevent the notification from disappearing and reset the timeout to the initial autoHideDuration value

Toaster Basic Usage

Toast Notification Basic Usage

Overrides

Additionally, you can fully customize any part of the Toast through the overrides prop. The Toast consists of multiple subcomponents that are listed bellow and you can override each one of them. To help you identify the names of these subcomponents, you can highlight them through this selector:

Note: You should always use longhand CSS properties. Mixing shorthands and longhands will lead into strange behaviors!

Toaster API

Toast API

autoHideDuration number = 0

The number of milliseconds to wait before automatically dismissing a notification. This behavior is disabled when the value is set to 0.

children union required

Toast notification content. The children-as-function receives a dismiss method that can be called to dismiss the notification and can be used as a handler for an action inside the toast content.

One of
ChildrenArrayNode,
dismiss function required () => undefined
=> Node

closeable boolean = true

When set to true a close button is displayed and the notification can be dismissed by a user.

kind $Values<typeof KIND> =

Defines the type of notification.

$ValuesObject.freeze({ info: "info", positive: "positive", warning: "warning", negative: "negative" })

notificationType $Values<typeof TYPE> =

$ValuesObject.freeze({ inline: "inline", toast: "toast" })

onClose function = () => undefined

A callback function called when a notification is dismissed.

() => mixed

onBlur function = () => undefined

Event => mixed

onFocus function = () => undefined

Event => mixed

onMouseEnter function = () => undefined

Event => mixed

onMouseLeave function = () => undefined

Event => mixed

"data-baseweb" string

overrides object = {}

Body { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>>
$kind required $ValuesObject.freeze({ info: "info", positive: "positive", warning: "warning", negative: "negative" })
$type required $ValuesObject.freeze({ inline: "inline", toast: "toast" })
$closeable boolean required
$isRendered boolean required
$isVisible boolean required
$style nullable Object
CloseIcon { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>>
$kind required $ValuesObject.freeze({ info: "info", positive: "positive", warning: "warning", negative: "negative" })
$type required $ValuesObject.freeze({ inline: "inline", toast: "toast" })
$closeable boolean required
$isRendered boolean required
$isVisible boolean required
$style nullable Object

key Key required

Key