LCARS-styled radio buttons functions.
lcarsRadio(
inputId,
label,
choices = NULL,
selected = NULL,
inline = FALSE,
width = NULL,
choiceNames = NULL,
choiceValues = NULL,
label_color = "#FFFFFF",
choice_color = label_color
)
lcarsRadioToggle(
inputId,
label,
choices = NULL,
selected = NULL,
width = NULL,
choiceNames = NULL,
choiceValues = NULL,
label_color = "atomic-tangerine",
choice_color = "#000000",
background_color = label_color,
checked_color = choice_color,
checked_background = "pale-canary"
)
character, the input slot that will be used to access the value.
character, display label for the control, or NULL
for no
label.
see shiny::radioButtons
for details.
The initially selected value (if not specified then defaults to the first value).
If TRUE
, render the choices inline (i.e. horizontally).
a valid CSS unit.
see shiny::radioButtons
for details.
Color for the label, choices text, choices background, checked text and checked background.
Can be any color given in hex format. Named colors must be LCARS colors.
See lcarsdata
for options.
A set of radio buttons that can be added to a UI definition.
lcarsRadio
is a minimal replacement for radioButtons
that
provides two additional color arguments for consistency with functions like
lcarsCheckbox
.
lcarsRadioToggle
is a more customized toggle style radio buttons
wrapper with more color controls.
## Only run examples in interactive R sessions
if (interactive()) {
ui <- lcarsPage(
fluidRow(
column(6,
lcarsRadio("dist1", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp"),
inline = TRUE,
label_color = "lilac",
choice_color = "atomic-tangerine"
),
plotOutput("distPlot1")
),
column(6,
lcarsRadioToggle("dist2", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp"),
width = "100%"
),
plotOutput("distPlot2")
)
)
)
server <- function(input, output) {
output$distPlot1 <- renderPlot({
dist <- switch(input$dist1,
norm = rnorm,
unif = runif,
lnorm = rlnorm,
exp = rexp,
rnorm)
hist(dist(500))
})
output$distPlot2 <- renderPlot({
dist <- switch(input$dist2,
norm = rnorm,
unif = runif,
lnorm = rlnorm,
exp = rexp,
rnorm)
hist(dist(500))
})
}
shinyApp(ui, server)
}