Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vex alert remove close button #3

Open
analytichealth opened this issue Oct 7, 2021 · 1 comment
Open

Vex alert remove close button #3

analytichealth opened this issue Oct 7, 2021 · 1 comment

Comments

@analytichealth
Copy link

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)
@pvictor
Copy link
Member

pvictor commented Oct 14, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants