An on/off switch widget similar to bslib::input_switch() that can be
included in an inline() wrapper.
Arguments
- id
The
inputslot that will be used to access the value.- value
Whether the switch is initially off or on;
FALSEfor off,TRUEfor on.- on, off
Labels that will appear to the right of the switch when the switch is on or off, respectively. These can be character strings or HTML elements. For example, you can style these with a span and apply one of the Bootstrap 5 text color classes (see examples).
NULLfor no labels.- meaning
A descriptive label, for people using assistive technology such as screen readers.
Value
An inline widget to be included in an inline() wrapper.
See also
bslib::input_switch for how the switch works with your Shiny server.
Examples
ui <- bslib::page_fixed(
shiny::h1("Switch test"),
inline("The server is now ",
inline_switch("myswitch", TRUE,
on = shiny::span(class = "text-success", "powered ON"),
off = shiny::span(class = "text-danger", "powered OFF"),
meaning = "Server power switch"),
"."
)
)