Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 587 Bytes

README.md

File metadata and controls

14 lines (10 loc) · 587 Bytes

Select input with groupings of options

This isn't really a trick as much as an undocumented feature in Shiny that not many people know about. Usually when people write dropdowns in Shiny, all the options are just provided as one long list. But it is possible to have groups of items, and it's very easy to do, for example:

selectInput("country", "Select country", list(
  "Europe" = c("Germany", "Spain"),
  "North America" = c("Canada", "United States" = "USA")
))

Demo