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"))

Arguments

id

The shared id of the dropdownButtonUI() and the dropdownButton() module

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 "dropdown" or "dropup"

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 "showcase", shows application code and metadata from a DESCRIPTION file in the application directory alongside the application. If set to "normal", displays the application normally. Defaults to "auto", which displays the application in the mode given in its DESCRIPTION file, if any.

Functions

  • dropdownButtonUI: Creates the dropdown button UI.

  • dropdownButtonDemo: Example app demonstrating usage of the dropdownButton module.

Usage

  • ui: dropdownButtonUI()

  • server: dropdownButton()

Examples

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) }