Skip to contents

f7Toast creates a small toast notification from the server side.

Usage

f7Toast(
  text,
  position = c("bottom", "top", "center"),
  closeButton = TRUE,
  closeButtonText = "close",
  closeButtonColor = "red",
  closeTimeout = 3000,
  icon = NULL,
  ...,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

text

Toast content.

position

Toast position c("bottom", "top", "center").

closeButton

Whether to close the toast with a button. TRUE by default.

closeButtonText

Close button text.

closeButtonColor

Close button color.

closeTimeout

Time before toast closes.

icon

Optional. Expect f7Icon. Warning: Adding icon will hide the close button.

...

Other options. See https://framework7.io/docs/toast.html#toast-parameters.

session

Shiny session.

Examples

if (interactive()) {
 library(shiny)
 library(shinyMobile)
 shinyApp(
  ui = f7Page(
    title = "Toast",
    f7SingleLayout(
      navbar = f7Navbar(title = "f7Toast"),
      f7Button(inputId = "toast", label = "Open Toast")
    )
  ),
  server = function(input, output, session) {
    observeEvent(input$toast, {
      f7Toast(
        position = "top",
        text = "I am a toast. Eat me!"
      )
    })
  }
 )
}