library(shiny)
library(shinyWidgets)
ui <- fluidPage(
html_dependency_winbox(),
actionButton(inputId = "show", label = "Show WinBox"),
verbatimTextOutput("res")
)
server <- function(input, output, session) {
observeEvent(input$show, {
WinBox(
title = "WinBox window",
ui = tagList(
tags$h2("Hello from WinBox!"),
"Text content of winbox.",
selectInput("month", "Select a month:", month.name)
)
)
})
output$res <- renderPrint(input$month)
}
if (interactive())
shinyApp(ui, server)
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
html_dependency_winbox(),
actionButton("minimize", "Minimize WinBox"),
actionButton("maximize", "Maximize WinBox"),
actionButton("setBackground", "Set background"),
actionButton("setTitle", "Set title"),
actionButton("resize", "Resize"),
actionButton("move", "Move")
)
server <- function(input, output, session) {
WinBox(
id = "myWb",
title = "WinBox",
ui = tagList(
tags$h3("Hello from WinBox!"),
tags$p("Some content for the WinBox")
)
)
observeEvent(input$minimize, {
applyWinBox("myWb", "minimize")
})
observeEvent(input$maximize, {
applyWinBox("myWb", "maximize")
})
observeEvent(input$setBackground, {
applyWinBox("myWb", "setBackground", "#ff005d")
})
observeEvent(input$setTitle, {
applyWinBox("myWb", "setTitle", "This is a new title")
})
observeEvent(input$resize, {
applyWinBox("myWb", "resize", "50%", "50%")
})
observeEvent(input$move, {
applyWinBox("myWb", "move", "center", "center")
})
}
if (interactive())
shinyApp(ui, server)
Run the code above in your browser using DataLab