Combobox
Description
A searchable select with an editable text input and a hidden value input.
Usage
bc_combobox(
id,
...,
placeholder = "",
name = id,
selected = "",
empty = "No items found.",
multiple = FALSE,
auto_highlight = FALSE,
disabled = FALSE,
class = NULL,
aria_label = NULL
)
Arguments
| Argument | Description |
|---|---|
id |
String. The ID for the combobox root. Input, popover and listbox IDs derive from it. |
... |
For bc_combobox(), option tags from bc_combobox_option() and bc_combobox_group(), or plain character values that become simple options. |
placeholder |
String. Text shown while empty. |
name |
String. The name of the hidden value input. |
selected |
String or character vector. Initial value, or values in multiple mode. |
empty |
String. Text shown when filtering finds no options. |
multiple |
Bool. Whether the listbox accepts several selections. |
auto_highlight |
Bool. Whether the first visible option activates when the list opens or filters. |
disabled |
Bool. Whether the input is disabled. |
class |
Vector of class names merged onto the combobox root. |
aria_label |
String. Accessible name for the input, since its placeholder alone is not one. |
Value
A <div> tag of class combobox.
Details
Submits a string, or a JSON array when multiple = TRUE.
See Also
bc_combobox_option(), bc_combobox_group(), bc_combobox_separator()
Examples
bc_combobox(
"framework",
bc_combobox_option("Next.js"),
bc_combobox_option("SvelteKit"),
bc_combobox_option("Remix"),
placeholder = "Select a framework",
class = "w-60"
)