dreamRs / shinypop

Collection of notifications, confirm dialogs and alerts for 'Shiny' applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vex alert remove close button

analytichealth opened this issue · comments

Hi, very cool package.

I was expecting this example to not show a button (similar to easyClose = FALSE for a shiny::modalDialog).
Please advise how I can remove the button.

Thank you

ui <- fluidPage(
  tags$h2("Alert with vex example"),
  use_vex(),
  actionButton("launch", "Launch an alert")
)

server <- function(input, output, session) {
  
  observeEvent(input$launch, {
    vex(
      showCloseButton = FALSE,
      escapeButtonCloses = FALSE,
      overlayClosesOnClick = FALSE,
      session = session,
      tags$div(
      style = "text-align: center;",
      tags$h3("Attention"),
      tags$br(),
      tags$p("This alert was sent from the server")
    ))
  })
  
}

shinyApp(ui, server)

Thanks ! An argument was missing, re-install grom GitHub then try :

library(shiny)
library(shinypop)
library(htmltools)

ui <- fluidPage(
  tags$h2("Alert with vex example"),
  use_vex(),
  actionButton("launch", "Launch an alert")
)

server <- function(input, output, session) {
  
  observeEvent(input$launch, {
    vex(
      showCloseButton = FALSE,
      showButton = FALSE,
      escapeButtonCloses = FALSE,
      overlayClosesOnClick = FALSE,
      tags$div(
        style = "text-align: center;",
        tags$h3("Attention"),
        tags$br(),
        tags$p("You cannot close this alert, it will automatically disappear after 4 seconds.")
      ))
    Sys.sleep(4)
    vex_close()
  })
  
}

shinyApp(ui, server)

Victor