View source: R/input-colorselector.R
colorSelectorInput | R Documentation |
Choose between a restrictive set of colors.
colorSelectorInput(
inputId,
label,
choices,
selected = NULL,
mode = c("radio", "checkbox"),
display_label = FALSE,
ncol = 10
)
colorSelectorExample()
inputId |
The |
label |
Display label for the control, or |
choices |
A list of colors, can be a list of named list, see example. |
selected |
Default selected color, if |
mode |
|
display_label |
Display list's names after palette of color. |
ncol |
If choices is not a list but a vector, go to line after n elements. |
colorSelectorExample()
: Examples of use for colorSelectorInput
if (interactive()) {
# Full example
colorSelectorExample()
# Simple example
ui <- fluidPage(
colorSelectorInput(
inputId = "mycolor1", label = "Pick a color :",
choices = c("steelblue", "cornflowerblue",
"firebrick", "palegoldenrod",
"forestgreen")
),
verbatimTextOutput("result1")
)
server <- function(input, output, session) {
output$result1 <- renderPrint({
input$mycolor1
})
}
shinyApp(ui = ui, server = server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.