Change la valeur d'un checkboxInput

updateCheckboxInput_dsfr(
  inputId,
  label = NULL,
  value = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

inputId

id de l'input

label

label du bouton

value

TRUE (coché) ou FALSE (non coché)

session

la session, la valeur par défaut est getDefaultReactiveDomain().

Value

html

See also

updateCheckboxInput() pour en savoir plus sur la fonction Shiny originelle.

Examples

## Only run examples in interactive R sessions
if (interactive()) {
  ui <- fluidPage_dsfr(
    checkboxInput_dsfr(inputId = 'inCheckboxInput', label = 'test', value = FALSE),
    actionButton_dsfr("go", "Change")
  )
  server <- function(input, output, session) {
    
    observeEvent(input$go, {
      updateCheckboxInput_dsfr(
        session = session,
        inputId = "inCheckboxInput",
        label = "Un nouveau label",
        value = TRUE
      )
    })
    
    observeEvent(input$inCheckboxInput, {
      message(input$inCheckboxInput)
    })
  }
  shinyApp(ui, server)
}