toast: Create an adminLTE toast

Description Usage Arguments Examples

View source: R/feedbacks.R

Description

Builtin AdminLTE3 toasts

Usage

1
2
3
4
5
6
7
toast(
  title,
  body = NULL,
  subtitle = NULL,
  options = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

title

Toast title.

body

Body content.

subtitle

Toast subtitle.

options

Toasts options: a list. See https://adminlte.io/docs/3.0/javascript/toasts.html.

session

Shiny session object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
if (interactive()) {
  library(shiny)
  library(bs4Dash)

  shinyApp(
    ui = dashboardPage(
      header = dashboardHeader(),
      sidebar = dashboardSidebar(),
      body = dashboardBody(
        actionButton("sendToast", "Send Toast")
      ),
      controlbar = dashboardControlbar(),
      title = "Toasts"
    ),
    server = function(input, output) {
      observeEvent(input$sendToast, {
        toast(
          title = "My Toast",
          body = h4("I am a toast!"),
          options = list(
            autohide = TRUE,
            icon = "fas fa-home",
            close = FALSE
          )
        )
      })
    }
  )
}

hiplot/bs4Dash2 documentation built on Dec. 20, 2021, 3:51 p.m.