View source: R/glass_multiselect.R
| glassMultiSelect | R Documentation |
A stylized multi-select Shiny input with optional search, style switching,
select-all behavior, and programmatic updates via updateGlassMultiSelect().
glassMultiSelect(
inputId,
choices,
selected = NULL,
label = NULL,
placeholder = "Filter by Category",
all_label = "All categories",
check_style = c("checkbox", "check-only", "filled"),
show_style_switcher = TRUE,
show_select_all = TRUE,
show_clear_all = TRUE,
theme = "dark",
shape = c("rounded", "square"),
width = NULL,
disabled = FALSE,
disabled_choices = NULL,
hues = NULL,
dark_selector = NULL,
server = FALSE,
server_limit = 50L,
server_min_chars = 0L
)
inputId |
Shiny input id. |
choices |
Named or unnamed character vector of choices. |
selected |
Initially selected values. Defaults to all choices when
|
label |
Optional field label shown above the widget. |
placeholder |
Trigger label when nothing is selected. |
all_label |
Label shown when all choices are selected. |
check_style |
One of |
show_style_switcher |
Show the Check / Box / Fill switcher row inside
the dropdown? Default |
show_select_all |
Show the "Select all" row? Default |
show_clear_all |
Show the "Clear all" footer link? Default |
theme |
Color theme. One of |
shape |
Corner style for the trigger and dropdown. One of
|
width |
Optional widget width passed to
|
disabled |
Logical. When |
disabled_choices |
Optional character vector of choice values to render
as disabled (non-selectable) rows. Default |
hues |
Optional named integer vector of HSL hue angles (0 to 360) for
the |
dark_selector |
Optional CSS selector that signals dark mode (e.g.
|
server |
Logical. If |
server_limit |
Maximum number of choices rendered initially and returned
for each server-side search. Default |
server_min_chars |
Minimum search characters required before server-side
matching filters choices. Default |
The widget registers two Shiny inputs:
input$<inputId> : character vector of selected values
input$<inputId>_style : active style string
("checkbox", "check-only", or "filled")
By default, when selected = NULL, all choices are initially selected.
This preserves the existing package behavior.
An htmltools::tagList containing the trigger button, dropdown
panel, and scoped <style> block.
Other glass select widgets:
glassMultiSelectServer(),
glassMultiSelectValue(),
glassSelect(),
glassSelectServer(),
glassSelectValue(),
updateGlassMultiSelect(),
updateGlassSelect()
fruits <- c(Apple = "apple", Banana = "banana", Cherry = "cherry")
# Minimal
fruit_filter <- glassMultiSelect("f", fruits)
# Lock style, hide extra controls
locked_filter <- glassMultiSelect(
"f",
fruits,
check_style = "check-only",
show_style_switcher = FALSE,
show_select_all = FALSE,
show_clear_all = FALSE
)
# Light theme
light_filter <- glassMultiSelect("f", fruits, theme = "light")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.