View source: R/selectControl.R
| HTMLgroupedChoices | R Documentation |
Create an object for grouped choices resorting to HTML.
HTMLgroupedChoices(groups, labels, values)
groups |
list of HTML elements which can be created
with the |
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 |
An object to be passed on to the choices argument of the
selectControlInput function.
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("•"), x, style="color: red")
}),
lapply(list("WA", "OR", "CA"), function(x){
tags$span(HTML("•"), x, style="color: green")
}),
lapply(list("MN", "WI", "IA"), function(x){
tags$span(HTML("•"), x, style="color: blue")
})
),
values = list(
list("NY", "NJ", "CT"),
list("WA", "OR", "CA"),
list("MN", "WI", "IA")
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.