update_multiple_checkbox | R Documentation |
Change the value of a multiple_checkbox
input on the client.
update_multiple_checkbox(
session = getDefaultReactiveDomain(),
input_id,
choices = NULL,
choices_value = choices,
selected = NULL,
label = NULL
)
update_multiple_radio(
session = getDefaultReactiveDomain(),
input_id,
choices = NULL,
choices_value = choices,
selected = NULL,
label = NULL
)
session |
The |
input_id |
The id of the input object |
choices |
All available options one can select from. If no need to update then leave as |
choices_value |
What reactive value should be used for corresponding choice. |
selected |
The initially selected value. |
label |
The label linked to the input |
if (interactive()) {
library(shiny)
library(shiny.semantic)
ui <- function() {
shinyUI(
semanticPage(
title = "Checkbox example",
form(
multiple_checkbox(
"simple_checkbox", "Letters:", LETTERS[1:5], selected = c("A", "C"), type = "slider"
)
),
p("Selected letter:"),
textOutput("selected_letter"),
shiny.semantic::actionButton("simple_button", "Update input to D")
)
)
}
server <- shinyServer(function(input, output, session) {
output$selected_letter <- renderText(paste(input[["simple_checkbox"]], collapse = ", "))
observeEvent(input$simple_button, {
update_multiple_checkbox(session, "simple_checkbox", selected = "D")
})
})
shinyApp(ui = ui(), server = server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.