Draggable Buckets
draggable_buckets.Rd
Usage
draggable_buckets(input_id, label, elements = character(), buckets)
Arguments
- input_id
(
character(1)
) theHTML
id of this widget- label
(
character(1)
orshiny.tag
) the header of this widget- elements
(
character
) the elements to drag into buckets- buckets
(
character
orlist
) the names of the buckets the elements can be put in or a list of key-pair values where key is a name of a bucket and value is a character vector of elements in a bucket
Examples
ui <- shiny::fluidPage(
draggable_buckets("id", "Choices #1", c("a", "b"), c("bucket1", "bucket2")),
draggable_buckets("id2", "Choices #2", letters, c("vowels", "consonants")),
shiny::verbatimTextOutput("out"),
shiny::verbatimTextOutput("out2")
)
server <- function(input, output) {
shiny::observeEvent(list(input$id, input$id2), {
print(shiny::isolate(input$id))
print(shiny::isolate(input$id2))
})
output$out <- shiny::renderPrint(input$id)
output$out2 <- shiny::renderPrint(input$id2)
}
if (interactive()) shiny::shinyApp(ui, server)
# With default elements in the bucket
ui <- shiny::fluidPage(
draggable_buckets("id", "Choices #1", c("a", "b"), list(bucket1 = character(), bucket2 = c("c"))),
shiny::verbatimTextOutput("out")
)
server <- function(input, output) {
shiny::observeEvent(input$id, {
print(shiny::isolate(input$id))
})
output$out <- shiny::renderPrint(input$id)
}
if (interactive()) shiny::shinyApp(ui, server)