Skip to content

Commit

Permalink
modal example
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Apr 4, 2024
1 parent 500052a commit 7ea7161
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions inst/examples/modal.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

library(shiny)
library(shinywb)

ui <- fluidPage(
html_dependency_winbox(),
actionButton(inputId = "show", label = "Show WinBox as modal")
)

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


observeEvent(input$show, {
WinBox(
title = "WinBox as modal",
ui = tagList(
tags$h2("Hello from WinBox!"),
"Text content of winbox.",
actionButton("show2", "Open a normal winbox")
),
options = wbOptions(modal = TRUE)
)
})

observeEvent(input$show2, {
WinBox(
title = "Normal WinBox",
ui = tagList(
tags$h2("Hello from WinBox!"),
"Text content of winbox."
),
options = wbOptions(background = "firebrick")
)
})

}

if (interactive())
shinyApp(ui, server)

0 comments on commit 7ea7161

Please sign in to comment.