5  Dropdown Group

5.2 Minimal Reprex Code

library(shiny)
library(shiny.fluent)

DropdownMenuItemType <- function(type) { # nolint
  JS(paste0("jsmodule['@fluentui/react'].DropdownMenuItemType."), type)
}

ui <- fluentPage(
  div(
    style = "height: 100%; width: 50%; margin:auto",
    Dropdown.shinyInput(
      inputId = "dropdown",
      label = "Group Selector",
      multiSelect = TRUE,
      placeholder = "Placeholder",
      options = list(
        list(key = "-", text = "Fruits", itemType = DropdownMenuItemType("Header")),
        list(key = "apple", text = "Apple"),
        list(key = "banana", text = "Banana"),
        list(key = "-", text = "Vegetables", itemType = DropdownMenuItemType("Header")),
        list(key = "broccoli", text = "Broccoli"),
        list(key = "carrot", text = "Carrot")
      )
    )
  )
)

server <- function(input, output, session) {
}

shinyApp(ui, server)

5.3 Reference