toggleSwitchInput: Switch state button

View source: R/input-toggleSwitch.R

toggleSwitchInputR Documentation

Switch state button

Description

Switch state button

Usage

toggleSwitchInput(
  inputId,
  label = NULL,
  on_label = "ON",
  off_label = "OFF",
  value = FALSE,
  class_name = "switch-styles"
)

Arguments

inputId

The input slot that will be used to access the value.

label

Display label for the toggle switch, NULL for no label.

on_label

Display label when toggle switch is on.

off_label

Display label when toggle switch is off.

value

Initial value of the toggle TRUE on, FALSE off.

Examples

## Not run: 
## Only run examples in interactive R sessions
if (interactive()) {

ui <- fluidPage(
    toggleSwitchInput(inputId = 'toggle', label = 'The toggle switch', value = TRUE)
    verbatimTextOutput('toggle_state')
)
server <- function(input, output) {

output$toggle_state <- renderPrint({
                   input$toggle
                })
}
shinyApp(ui, server)
}

## End(Not run)


datasketch/shinyinvoer documentation built on June 2, 2025, 2:14 a.m.