# Basic slider
calcite_slider(
id = "my_slider",
value = 50,
min = 0,
max = 100,
step = 5
)
# Slider with ticks and labels
calcite_slider(
id = "temperature",
value = 72,
min = 32,
max = 212,
step = 1,
ticks = 10,
label_handles = TRUE,
label_ticks = TRUE
)
# Range slider (dual handles)
calcite_slider(
id = "price_range",
min = 0,
max = 1000,
min_value = 100,
max_value = 500,
step = 10,
label_handles = TRUE
)
# Shiny example
if (interactive()) {
library(shiny)
ui <- calcite_shell(
calcite_card(
heading = "Slider Example",
calcite_label(
"Choose a value",
calcite_slider(
id = "my_slider",
value = 50,
min = 0,
max = 100,
step = 5,
label_handles = TRUE
)
),
verbatimTextOutput("slider_value")
)
)
server <- function(input, output, session) {
output$slider_value <- renderPrint({
paste("Current value:", input$my_slider$value)
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab