Skip to contents

Builds a toast on the client and shows it, much like shiny::showNotification(). A toast container is created on demand at placement if one is not already present, and the toast removes itself from the DOM once hidden.

Usage

bs_notify_toast(
  body,
  ...,
  title = NULL,
  color = NULL,
  autohide = TRUE,
  delay = 5000,
  placement = "top-end",
  session = shiny::getDefaultReactiveDomain()
)

Arguments

body

Notification body text. Plain text only (it is inserted with textContent client-side, so markup is not interpreted); tags raise an error.

...

Reserved for future extensions; must be empty.

title

Optional header title. Plain text only, like body.

color

Optional theme colour applied as a .text-bg-* background.

autohide

If TRUE (default), hide the toast automatically after delay milliseconds. Use FALSE for a persistent notification the user must dismiss.

delay

Delay in milliseconds before the toast auto-hides.

placement

Container placement (see bs_toast_container()).

session

The Shiny session.

Value

Invisibly NULL, called for its side effect.

Examples

if (interactive()) bs_notify_toast("Saved!", title = "Status", color = "success")