colorSelectorInput {shinyWidgets} | 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()
colorSelectorDrop(
inputId,
label,
choices,
selected = NULL,
display_label = FALSE,
ncol = 10,
circle = TRUE,
size = "sm",
up = FALSE,
width = NULL
)
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. |
circle |
Logical, use a circle or a square button |
size |
Size of the button : default, lg, sm, xs. |
up |
Logical. Display the dropdown menu above. |
width |
Width of the dropdown menu content. |
colorSelectorExample
: Examples of use for colorSelectorInput
colorSelectorDrop
: Display a colorSelector in a dropdown button
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)
}