inst/apps/024-optgroup-selectize/ui.R

fluidPage(sidebarLayout(
  sidebarPanel(
    # use regions as option groups
    selectizeInput('x1', 'X1', choices = list(
      Eastern = list(`New York` = 'NY', `New Jersey` = 'NJ'),
      Western = list(`California` = 'CA', `Washington` = 'WA')
    ), multiple = TRUE),

    # use updateSelectizeInput() to generate options later
    selectizeInput('x2', 'X2', choices = NULL),

    # an ordinary selectize input without option groups
    selectizeInput('x3', 'X3', choices = setNames(state.abb, state.name)),

    # a select input
    selectInput('x4', 'X4', choices = list(
      Eastern = list(`New York` = 'NY', `New Jersey` = 'NJ'),
      Western = list(`California` = 'CA', `Washington` = 'WA')
    ), selectize = FALSE)
  ),
  mainPanel(
    verbatimTextOutput('values')
  )
), title = 'Options groups for select(ize) input')
rstudio/shinycoreci documentation built on April 11, 2025, 3:17 p.m.