HTMLgroupedChoices: Choices with groups and HTML

View source: R/selectControl.R

HTMLgroupedChoicesR 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")
  )
)

shinySelect documentation built on Nov. 18, 2022, 5:10 p.m.