A shadcn toggle group. input$<inputId> is a string/NULL (single mode) or
a character vector (multiple mode).
Usage
shad_toggle_group(
inputId,
choices,
selected = NULL,
type = c("single", "multiple"),
variant = c("default", "outline"),
size = c("default", "sm", "lg"),
orientation = c("horizontal", "vertical"),
disabled = FALSE,
class = NULL,
...
)
shad_toggle_group_item(value, label = NULL, icon = NULL, disabled = FALSE)Arguments
- inputId
Input id.
- choices
A named/unnamed vector or a list of
shad_toggle_group_item().- selected
Initially pressed value(s).
- type
"single"or"multiple".- variant
"default"or"outline".- size
"default","sm", or"lg".- orientation
"horizontal"(default) or"vertical".- disabled
If
TRUE, disables every item.- class
Extra CSS classes.
- ...
Extra attributes on the group root.
- value
The item's value.
- label
The item's label (defaults to the value).
- icon
Optional icon for the item.
See also
Other shadshiny tier-2 components:
shad_calendar(),
shad_checkbox(),
shad_combobox(),
shad_date_picker(),
shad_date_presets(),
shad_form_field(),
shad_input(),
shad_input_group(),
shad_input_otp(),
shad_native_select(),
shad_radio_group(),
shad_select(),
shad_slider(),
shad_switch(),
shad_textarea(),
shad_toggle()
Examples
shad_toggle_group("align", choices = c(Left = "left", Center = "center",
Right = "right"), selected = "center", type = "single")
#> <div class="shad-toggle-group" data-shad="toggle-group" id="align" data-type="single" role="group">
#> <button type="button" class="shad-toggle" data-value="left" data-state="off">Left</button>
#> <button type="button" class="shad-toggle" data-value="center" data-state="on">Center</button>
#> <button type="button" class="shad-toggle" data-value="right" data-state="off">Right</button>
#> </div>