UI components to build dashboards with blockr
# install.packages("remotes")
remotes::install_github("blockr-org/blockr.ui")
library(shiny)
library(blockr.ui)
ui <- fluidPage(
theme = bslib::bs_theme(
version = 5
),
addStackUI("add"),
stacksArea(
id = "stacksArea",
class = "border border-dark",
style = "min-height:5rem;"
)
)
server <- \(input, output, session){
add <- add_stack_server("add", delay = 1000)
stacks <- list()
stacks_servers <- list()
observeEvent(add$dropped(), {
stack <- new_stack()
stacks <<- c(stacks, stack)
insertUI("#stacksArea", "afterBegin", ui = generate_ui(stack))
stacks_servers <<- c(stacks_servers, generate_server(stack))
})
}
shinyApp(ui, server, options = list(port = 3000L))