show_tabler_toast: Show a tabler toast on the client

Description Usage Arguments Examples

View source: R/tabler.R

Description

Show a tabler toast on the client

Usage

1
show_tabler_toast(id, options = NULL, session = getDefaultReactiveDomain())

Arguments

id

Toast id.

options

Toast options: see https://getbootstrap.com/docs/4.3/components/toasts/.

session

Shiny session

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
30
31
32
33
34
35
36
37
38
39
if (interactive()) {
 library(shiny)
 ui <- tabler_page(
  tabler_toast(
    id = "toast",
    title = "Hello",
    subtitle = "now",
    "Toast body",
    img = "https://preview-dev.tabler.io/static/logo.svg"
  ),
  tabler_button("launch", "Go!", width = "25%")
 )

 server <- function(input, output, session) {
   observe(print(input$toast))
   observeEvent(input$launch, {
     removeNotification("notif")
     show_tabler_toast(
       "toast",
       options = list(
         animation = FALSE,
         delay = 3000
       )
     )
   })

   observeEvent(input$toast, {
     showNotification(
       id = "notif",
       "Toast was closed",
       type = "warning",
       duration = 1,

     )
   })
 }

 shinyApp(ui, server)
}

DivadNojnarg/outstanding-shiny-ui-code documentation built on Nov. 2, 2021, 12:03 p.m.