# Using values and labels vectors (convenient)
calcite_select(
id = "my_select",
label = "Choose terrain type",
values = c("mountains", "rivers", "lakes", "buttes", "fjords"),
labels = c("Mountains", "Rivers", "Lakes", "Buttes", "Fjords")
)
# Using values only (labels default to values)
calcite_select(
id = "simple_select",
label = "Choose an option",
values = c("option1", "option2", "option3")
)
# Manually constructing options (more control)
calcite_select(
id = "fruit_select",
label = "Choose a fruit",
label_text = "Select your favorite fruit",
scale = "m",
calcite_option(label = "Apple", value = "apple"),
calcite_option(label = "Banana", value = "banana", selected = TRUE),
calcite_option(label = "Orange", value = "orange")
)
# Required select with validation
calcite_select(
id = "required_select",
label = "Required field",
label_text = "Make a selection",
required = TRUE,
status = "invalid",
validation_message = "Please select an option",
calcite_option(label = "Choose...", value = ""),
calcite_option(label = "Option A", value = "a"),
calcite_option(label = "Option B", value = "b")
)
Run the code above in your browser using DataLab