calcite_option: Create a Calcite Option Component

View source: R/option.R

calcite_optionR Documentation

Create a Calcite Option Component

Description

Option provides a selectable item within a calcite_select() component. Each option represents a single choice in the select dropdown menu.

Usage

calcite_option(label, value, disabled = NULL, selected = NULL, ...)

Arguments

label

Text label for the option (required for accessibility)

value

The component's value (can be any type)

disabled

When true, interaction is prevented and the component is displayed with lower opacity

selected

When true, the component is selected

...

Additional attributes passed to the component

Details

Options are used within calcite_select() to define the available choices. The value parameter determines what value will be sent to Shiny when the option is selected.

Value

An object of class calcite_component

References

Official Documentation

Examples

# Basic option
calcite_option(
  label = "First Option",
  value = "1"
)

# Selected option
calcite_option(
  label = "Default Selection",
  value = "default",
  selected = TRUE
)

# Disabled option
calcite_option(
  label = "Unavailable",
  value = "unavailable",
  disabled = TRUE
)

# Use with calcite_select
calcite_select(
  id = "my_select",
  label = "Choose one",
  calcite_option(label = "Option 1", value = "1"),
  calcite_option(label = "Option 2", value = "2", selected = TRUE),
  calcite_option(label = "Option 3", value = "3")
)

calcite documentation built on March 3, 2026, 5:07 p.m.