lcarsRadio | R Documentation |
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"
)
inputId |
character, the input slot that will be used to access the value. |
label |
character, display label for the control, or |
choices |
see |
selected |
The initially selected value; if not specified then defaults to the first value. |
inline |
If |
width |
a valid CSS unit. |
choiceNames , choiceValues |
see |
label_color , choice_color , background_color , checked_color , checked_background |
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. |
lcarsRadio()
is a minimal replacement for shiny::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.
A set of radio buttons that can be added to a UI definition.
## 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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.