twSliderInput {shiny.tailwind} | R Documentation |
Wrapper around shiny::sliderInput()
but allowing for more classes
Description
Note that the colors for the slider bar can be customized by overriding the
irs
class. c.f. 05-apply-directive example app
Usage
twSliderInput(
inputId,
label,
min,
max,
value,
step = NULL,
round = FALSE,
ticks = TRUE,
animate = FALSE,
width = NULL,
sep = ",",
pre = NULL,
post = NULL,
timeFormat = NULL,
timezone = NULL,
dragRange = TRUE,
container_class = NULL,
label_class = NULL,
input_class = NULL,
label_after_input = FALSE
)
Arguments
inputId |
The |
label |
Display label for the control, or |
min , max |
The minimum and maximum values (inclusive) that can be selected. |
value |
The initial value of the slider, either a number, a date
(class Date), or a date-time (class POSIXt). A length one vector will
create a regular slider; a length two vector will create a double-ended
range slider. Must lie between |
step |
Specifies the interval between each selectable value on the
slider. Either |
round |
|
ticks |
|
animate |
|
width |
The width of the input, e.g. |
sep |
Separator between thousands places in numbers. |
pre |
A prefix string to put in front of the value. |
post |
A suffix string to put after the value. |
timeFormat |
Only used if the values are Date or POSIXt objects. A time
format string, to be passed to the Javascript strftime library. See
https://github.com/samsonjs/strftime for more details. The allowed
format specifications are very similar, but not identical, to those for R's
|
timezone |
Only used if the values are POSIXt objects. A string
specifying the time zone offset for the displayed times, in the format
|
dragRange |
This option is used only if it is a range slider (with two
values). If |
container_class |
additional classes to be applied to the container |
label_class |
additional classes to be applied to the label |
input_class |
additional classes to be applied to the input element |
label_after_input |
TRUE/FALSE if the label should be put after the input box. Default is FALSE. Useful for special cases (floating labels), c.f. 05-apply-directive example app. |
Value
a list with a shiny.tag
class
See Also
Examples
shiny::sliderInput("values", "A Range", min = 0, max = 100, value = 75)
twSliderInput("values", "A Range",
min = 0, max = 100, value = 75,
container_class = "CONTAINER", label_class = "LABEL",
input_class = "INPUT"
)
# basic full shiny example
library(shiny)
ui <- fluidPage(
use_tailwind(),
twSliderInput(
"values", "A Range",
min = 0, max = 100, value = 75,
# Apply tailwind classes
container_class = "w-48 m-4 p-2 border border-gray-200 rounded-md drop-shadow-md",
label_class = "font-mono text-gray-600",
input_class = "drop-shadow-lg text-gray-600 font-mono rounded-md border-amber-400"
),
verbatimTextOutput("value")
)
server <- function(input, output) {
output$value <- renderText({
as.character(input$date)
})
}
if (interactive()) shiny::shinyApp(ui, server)