Description Usage Arguments Examples
Initialize with use_vex
in UI before
using vex
(alert) or vex_confirm
(confirmation dialog) server-side.
Retrieve value server-side with input$<inputId>
for vex_confirm
.
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 | use_vex(
theme = c("default", "os", "plain", "top", "wireframe", "bottom-right-corner",
"flat-attack")
)
vex(
content,
showCloseButton = TRUE,
showButton = TRUE,
labelButton = "OK",
escapeButtonCloses = TRUE,
overlayClosesOnClick = TRUE,
session = shiny::getDefaultReactiveDomain()
)
vex_confirm(
inputId,
content,
yes_text = "Ok",
no_text = "Cancel",
showCloseButton = FALSE,
escapeButtonCloses = FALSE,
overlayClosesOnClick = FALSE,
session = shiny::getDefaultReactiveDomain()
)
vex_close(session = shiny::getDefaultReactiveDomain())
|
theme |
Theme to use. Choose between |
content |
Text to display in the alert. |
showCloseButton |
Show or not a button to close alert. |
showButton |
Show or not a button ath the bottom of the alert. |
labelButton |
Label for the button. |
escapeButtonCloses |
Close alert when pressing escape button. |
overlayClosesOnClick |
Close alert when clicking outside alert. |
session |
Shiny session. |
inputId |
The |
yes_text |
Text to display on 'yes' button. |
no_text |
Text to display on 'no' button. |
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | library(shiny)
library(shinypop)
ui <- fluidPage(
tags$h2("Alert with vex example"),
use_vex(),
actionButton("launch", "Launch an alert")
)
server <- function(input, output, session) {
observeEvent(input$launch, {
vex(tags$div(
style = "text-align: center;",
tags$h3("Attention"),
tags$br(),
tags$p("This alert was sent from the server,"),
tags$p("probably something went", tags$b("wrong"))
))
})
}
if (interactive())
shinyApp(ui, server)
### Confirm ####'
if (interactive()) {
library(shiny)
ui <- fluidPage(
tags$h2("Confirm with vex example"),
use_vex(theme = "flat-attack"),
actionButton("ask", "Ask confirmation"),
verbatimTextOutput(outputId = "result")
)
server <- function(input, output, session) {
observeEvent(input$ask, {
vex_confirm(
inputId = "confirm",
content = tags$div(
style = "text-align: center;",
"Are your sure?"
),
yes_text = "Yep! I'm sure",
no_text = "Nope, cancel!"
)
})
output$result <- renderPrint({
input$confirm
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.