# Basic segmented control
calcite_segmented_control(
id = "view_mode",
calcite_segmented_control_item(value = "list", icon_start = "list"),
calcite_segmented_control_item(value = "grid", icon_start = "grid", checked = TRUE),
calcite_segmented_control_item(value = "table", icon_start = "table")
)
# Full width with text
calcite_segmented_control(
id = "effect",
width = "full",
calcite_segmented_control_item(value = "Blur"),
calcite_segmented_control_item(value = "Highlight", checked = TRUE),
calcite_segmented_control_item(value = "Party mode")
)
# Shiny example
if (interactive()) {
library(shiny)
ui <- calcite_shell(
calcite_card(
heading = "Segmented Control Example",
calcite_label(
"Choose an option",
calcite_segmented_control(
id = "my_control",
width = "full",
calcite_segmented_control_item(value = "option1"),
calcite_segmented_control_item(value = "option2", checked = TRUE),
calcite_segmented_control_item(value = "option3")
)
),
verbatimTextOutput("selected_value")
)
)
server <- function(input, output, session) {
output$selected_value <- renderPrint({
paste("Selected:", input$my_control$value)
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab