Description Usage Arguments Examples
View source: R/checkbox_group.R
Create a custom checkbox input group
1 2 3 4 5 6 7 8 | checkbox_group(
inputId,
title,
caption = NULL,
choices,
values = NULL,
checked = FALSE
)
|
inputId |
a unique id for the input group |
title |
a title for the inputs |
caption |
an optional caption to display |
choices |
an array of choices |
values |
an array of values to display |
checked |
an array of logical values to check an input at start |
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 40 41 42 43 44 | if (interactive()) {
librar(shiny)
ui <- tagList(
iceComponents::use_iceComponents(),
tags$h2("Checkbox group example"),
iceComponents::checkbox_group(
inputId = "pizza_toppings",
title = "Your favorite pizza toppings",
caption = "Select your favorite toppings",
choices = c(
"Pepperoni",
"Mushrooms",
"Onions",
"Sausage",
"Bacon",
"Extra Cheese",
"Black Olives",
),
checked = TRUE
),
tags$button(
id = "reset",
class = "shiny-bound-input action-button",
"Reset Toppings"
),
tags$button(
id = "clear",
class = "shiny-bound-input action-button",
"Clear Selections"
)
)
server <- function(input, output) {
observe({
print(input$pizza_toppings)
})
observeEvent(input$reset, {
iceComponents::reset_checkbox_group(inputId = "pizza_toppings")
})
observeEvent(input$clear, {
iceComponents::clear_checkbox_group(inputId = "pizza_toppings")
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.