Learn R Programming

shinyBS (version 0.20)

DropDowns: Twitter Bootstrap NavBar Dropdowns

Description

Add and update Twitter Bootstrap NavBar Dropdowns in shiny.

Usage

bsNavDropDown(inputId, label, choices, selected="")
updateDropDown(session, inputId, label = NULL, choices = NULL, selected = NULL)

Arguments

session
The session object passed to function given to shinyServer
inputId
Input variable to assign the control's value to
label
The label that will appear on the object
choices
A list of values to appear in the dropdown
selected
The value to set for the input object

Details

Dropdowns are an alternative to selectInput objects that can appear in a navBar. The structure of the function to create and update them has been modeled after that function. A dropdown returns the value of the last dropdown element in its choices link that has been clicked.

References

http://getbootstrap.com/2.3.2/components.html{Navbars for Twitter Bootstrap 2.3.2} http://getbootstrap.com/2.3.2/components.html{Dropdowns for Twitter Bootstrap 2.3.2}

See Also

selectInput

Examples

Run this code
## In ui.R
  ## Create a dropdown
  bsNavDropDown(inputId = "dd1", label = "Distribution", 
                choices = c("Normal", "Lognormal", "Gamma"),
                selected = "Normal")
                
  ## In server.R
  ## Add another distribution to the list
  updateDropDown("dd1" choices = c("Normal", "Lognormal", "Gamma", "Exponential"))

Run the code above in your browser using DataLab