Description Usage Arguments Value See Also Examples
Create a group of checkboxes that can be used to toggle multiple choices independently. The server will receive the input as a character vector of the selected values.
1 2 3 |
inputId |
The |
label |
Display label for the control, or |
choices |
List of values to show checkboxes for. If elements of the list
are named then that name rather than the value is displayed to the user. If
this argument is provided, then |
selected |
The values that should be initially selected, if any. |
inline |
If |
width |
The width of the input, e.g. |
choiceNames, choiceValues |
List of names and values, respectively,
that are displayed to the user in the app and correspond to the each
choice (for this reason, |
A list of HTML elements that can be added to a UI definition.
checkboxInput
, updateCheckboxGroupInput
Other input elements: actionButton
,
checkboxInput
, dateInput
,
dateRangeInput
, fileInput
,
numericInput
, passwordInput
,
radioButtons
, selectInput
,
sliderInput
, submitButton
,
textAreaInput
, textInput
,
varSelectInput
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ## Only run examples in interactive R sessions
if (interactive()) {
ui <- fluidPage(
checkboxGroupInput("variable", "Variables to show:",
c("Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear")),
tableOutput("data")
)
server <- function(input, output, session) {
output$data <- renderTable({
mtcars[, c("mpg", input$variable), drop = FALSE]
}, rownames = TRUE)
}
shinyApp(ui, server)
ui <- fluidPage(
checkboxGroupInput("icons", "Choose icons:",
choiceNames =
list(icon("calendar"), icon("bed"),
icon("cog"), icon("bug")),
choiceValues =
list("calendar", "bed", "cog", "bug")
),
textOutput("txt")
)
server <- function(input, output, session) {
output$txt <- renderText({
icons <- paste(input$icons, collapse = ", ")
paste("You chose", icons)
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.