Update toggle_input_386 on the client
Arguments
- session
The
session
object passed to function given toshinyServer
. Default isgetDefaultReactiveDomain()
.- inputId
The id of the input object.
- label
The label to set for the input object.
- value
Initial value (
TRUE
orFALSE
).
Examples
if (interactive()) {
library(shiny)
library(shiny386)
ui <- page_386(
button_386("update", "Go!", class = "btn-lg"),
toggle_input_386("toggle", "Switch", value = TRUE)
)
server <- function(input, output, session) {
observe(print(input$toggle))
observeEvent(input$update, {
update_toggle_input_386(
session,
"toggle",
value = !input$toggle
)
})
}
shinyApp(ui, server)
}