HTMLgroupedChoices {shinySelect}R Documentation

Choices with groups and HTML

Description

Create an object for grouped choices resorting to HTML.

Usage

HTMLgroupedChoices(groups, labels, values)

Arguments

groups

list of HTML elements which can be created with the HTML function or shiny.tag objects, the headings

labels

list of lists, one list for each group, made of HTML elements

values

list of lists of character strings, each label must have a value

Value

An object to be passed on to the choices argument of the selectControlInput function.

Examples

library(shinySelect)
library(shiny)
states <- HTMLgroupedChoices(
  groups = lapply(list("East Coast", "West Coast", "Midwest"), function(x){
    tags$h2(x, style="text-decoration: underline")
  }),
  labels = list(
    lapply(list("NY", "NJ", "CT"), function(x){
      tags$span(HTML("&bull;"), x, style="color: red")
    }),
    lapply(list("WA", "OR", "CA"), function(x){
      tags$span(HTML("&bull;"), x, style="color: green")
    }),
    lapply(list("MN", "WI", "IA"), function(x){
      tags$span(HTML("&bull;"), x, style="color: blue")
    })
  ),
  values = list(
    list("NY", "NJ", "CT"),
    list("WA", "OR", "CA"),
    list("MN", "WI", "IA")
  )
)

[Package shinySelect version 1.3.0 Index]