Creates a bootstrap dropdown button UI, with a server module that returns the id of the most recently clicked button.
dropdownButtonUI(id, options, label = "Options", type = "dropdown", buttonId = paste0(id, "-dropdown"), class = "btn-default") dropdownButton(id, options) dropdownButtonDemo(display.mode = c("showcase", "normal", "auto"))
id | The shared |
---|---|
options | A named vector of options and labels. The name is the label that will appear on the button and the value is the id of the input that is returned from the Shiny modules. |
label | The button text of the "master" button containing the dropdown buttons. |
type | Type of dropdown: one of |
buttonId | The HTML id of the dropdown button. |
class | CSS classes to be added to the dropdown button. |
display.mode | The mode in which to display the application. If set to
the value |
dropdownButtonUI
: Creates the dropdown button UI.
dropdownButtonDemo
: Example app demonstrating usage of the
dropdownButton module.
ui: dropdownButtonUI()
server: dropdownButton()
if (interactive()) { library(shiny) button_options <- c( "Option A" = "opt_a", "Option B" = "opt_b" ) ui <- fluidPage( dropdownButtonUI( id = "dropdown", options = button_options, label = "Options" ), verbatimTextOutput("chosen") ) server <- function(input, output) { last_clicked <- dropdownButton("dropdown", button_options) output$chosen <- renderPrint({ last_clicked() }) } shinyApp(ui = ui, server = server) }