Command
Description
A searchable command palette or standalone command list.
Usage
bc_command(
...,
id = NULL,
placeholder = "Type a command or search...",
empty = "No results found.",
label = "Command menu",
dialog = FALSE,
trigger = NULL,
manual = FALSE,
icon = NULL
)
bc_command_item(
label,
...,
shortcut = NULL,
icon = NULL,
disabled = FALSE,
href = NULL,
filter = NULL,
keywords = NULL,
force = FALSE,
keep_open = FALSE,
checked = FALSE
)
bc_command_group(title, ...)
bc_command_separator()
Arguments
| Argument | Description |
|---|---|
... |
Command content. Strings become command items, tags pass through and lists are passed to bc_command_item(). Build the rest with bc_command_group() and bc_command_separator(). |
id |
String. The ID for the command root, or the dialog when dialog = TRUE. |
placeholder |
String. Placeholder text for the filter input. |
empty |
String. Message shown when nothing matches the filter. |
label |
String. The item's label, used as the filter text. |
dialog |
Bool. Wrap the command in a <dialog class="command-dialog"> with a trigger button. |
trigger |
String. The trigger button's label when dialog = TRUE. |
manual |
Bool. Add data-filter="manual" when the app owns filtering. |
icon |
A tag. An icon before the label. |
shortcut |
String. A shortcut hint shown at the inline end. |
disabled |
Bool. Mark the item as disabled. |
href |
String. When given, the item is an <a role="menuitem">. |
filter |
String. Overrides the text matched against the input. |
keywords |
String. Extra terms matched against the input. |
force |
Bool. Keep the item visible whatever the filter. |
keep_open |
Bool. Keep the command open when the item is chosen. |
checked |
Bool. Show the item's indicator. |
title |
String. A group heading shown above its items. |
Value
A <div class="command">, or a trigger button and <dialog> pair.
Examples
bc_command(
bc_command_group("Suggestions", "Calendar", "Search Emoji"),
bc_command_separator(),
bc_command_item("Profile", shortcut = "CmdP")
)