An LCARS styled toggle button that can be used in place of
shiny::checkboxInput()
and lcarsCheckbox()
.
lcarsToggle(
inputId,
label,
value = FALSE,
pill = FALSE,
inverse = FALSE,
true = "Yes",
false = "No",
true_color = "dodger-pale",
false_color = "atomic-tangerine",
background_color = "#000000",
border_color = ifelse(inverse, false_color, background_color),
outer_border = FALSE,
outer_color = "#000000",
label_color = "#FFFFFF",
label_right = FALSE,
width = NULL
)
character, the input slot that will be used to access the value.
character, display label for the control, or NULL
for no label.
logical, initial value.
logical, use an LCARS pill style with rounded ends instead of the default rounded rectangle.
logical, invert the color presentation.
character, text label for TRUE
position.
character, text label for FALSE
position.
Color for TRUE
position. Can be any color given in hex
format. Named colors must be LCARS colors. See lcarsdata for options.
Color for FALSE
position, as above.
background color, as above.
border color, as above.
logical, use outer border. This makes some adjustments to inner elements if used.
outer border color, as above.
label text color, as above.
logical, set to TRUE
to right align label text.
character, use only px
units for this widget, e.g. "150px"
(the default when NULL
). Percentage is the only other unit allowed. It
works, but not as well. Fixed widths recommended.
A toggle button control that can be added to a UI definition.
## Only run examples in interactive R sessions
if(interactive()){
ui <- lcarsPage(
lcarsToggle("somevalue", "Some value", FALSE),
verbatimTextOutput("value")
)
server <- function(input, output) {
output$value <- renderText({ input$somevalue })
}
shinyApp(ui, server)
}