add_notie_alert: Implemente la fonction alert de la librairie JS notie

View source: R/add_notie_alert.R

add_notie_alertR Documentation

Implemente la fonction alert de la librairie JS notie

Description

Implemente la fonction alert de la librairie JS notie

Usage

add_notie_alert(
  type = "success",
  text = "",
  stay = FALSE,
  time = 3,
  position = "top",
  session
)

Arguments

type

type d'alerte : string ('success', 'warning', 'error', 'info', 'neutral')

text

texte affiche dans l'alerte

stay

la notif reste elle affichee sur l'ecran (boolean)

time

duree d'affichage de la notif

position

position de la notif : string ('top', 'bottom')

session

argument session shiny

Details

https://github.com/jaredreich/notie

https://codingshiksha.com/javascript/notie-js-javascript-alert-toast-notification-library-full-tutorial-with-examples/

Value

une alerte notie

Examples

## Not run: library(shiny)
library(shinyYM)

ui <- fluidPage(
 add_notie_deps(),
 actionButton(inputId = "b1", "alert success"),
 actionButton(inputId = "b2", "alert warning"),
 actionButton(inputId = "b3", "alert error"),
 actionButton(inputId = "b4", "alert info"),
 actionButton(inputId = "b5", "alert neutral")
)

server <- function(input, output, session) {

 observeEvent(input$b1,
               add_notie_alert(type = "success", text = "success",
                stay = FALSE, time = 3, position = "top", session)
  )

  observeEvent(input$b2,
               add_notie_alert(type = "warning", text = "warning",
                stay = TRUE, time = 3, position = "bottom", session)
  )

  observeEvent(input$b3,
               add_notie_alert(type = "error", text = "error",
                stay = TRUE, time = 1, position = "bottom", session)
  )

  observeEvent(input$b4,
               add_notie_alert(type = "info", text = "info",
                stay = FALSE, time = 5, position = "top", session)
  )

  observeEvent(input$b5,
               add_notie_alert(type = "neutral", text = "neutral",
                stay = FALSE, time = 3, position = "bottom", session)
  )

}

# Run the application
shinyApp(ui = ui, server = server)

## End(Not run)

ymansiaux/shinyYM documentation built on March 20, 2022, 11:53 p.m.