| inline_switch | R Documentation |
An on/off switch widget similar to bslib::input_switch() that can be
included in an inline() wrapper.
inline_switch(id, value, on = "On", off = "Off", meaning = NULL)
id |
The |
value |
Whether the switch is initially off or 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). |
meaning |
A descriptive label, for people using assistive technology such as screen readers. |
An inline widget to be included in an inline() wrapper.
bslib::input_switch for how the switch works with your Shiny server.
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"),
"."
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.