update_tabler_switch: Update tabler_switch on the client

Description Usage Arguments Examples

Description

Update tabler_switch on the client

Usage

1
update_tabler_switch(session, inputId, label = NULL, value = NULL)

Arguments

session

The session object passed to function given to shinyServer. Default is getDefaultReactiveDomain().

inputId

The id of the input object.

label

The label to set for the input object.

value

Initial value (TRUE or FALSE).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (interactive()) {
 library(shiny)
 ui <- tabler_page(
  tabler_body(
    tabler_row(
      tabler_button("update", "Go!", width = "25%", class = "mr-2"),
      tabler_switch("toggle", "Switch", value = TRUE, width = "25%")
    )
  )
 )

 server <- function(input, output, session) {
   observe(print(input$toggle))
   observeEvent(input$update, {
     update_tabler_switch(
       session,
       "toggle",
       value = !input$toggle
     )
   })
 }

 shinyApp(ui, server)
}

DivadNojnarg/outstanding-shiny-ui-code documentation built on Nov. 2, 2021, 12:03 p.m.