Command

Description

Create a searchable command menu, inline or in a modal.

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
... For bc_command() and bc_command_group(), items from bc_command_item(), bc_command_group() and bc_command_separator(). A string becomes an item, and a list is passed to bc_command_item() as its arguments. For bc_command_item(), extra tag attributes.
id String. The ID. Defaults to a random ID.
placeholder String. Placeholder text for the search input.
empty String. Message shown when nothing matches the search. Defaults to "No results found.".
label String. The item's label, also used as its search text.
dialog Bool. Show the menu in a modal opened by a button. Defaults to FALSE.
trigger String. The button's label when dialog = TRUE. Defaults to "Open Menu".
manual Bool. Turn off the built-in search so your app filters the items itself. Defaults to FALSE.
icon Tag. An icon before the label.
shortcut String. A shortcut hint shown at the end of the item.
disabled Bool. Whether the item is disabled. Defaults to FALSE.
href String. A link URL. When set, the item is a link.
filter String. Search text to use instead of label.
keywords String. Extra search terms.
force Bool. Keep the item visible whatever the search. Defaults to FALSE.
keep_open Bool. Keep the menu open when the item is chosen. Defaults to FALSE.
checked Bool. Show a check mark beside the item. Defaults to FALSE.
title String. A group title shown above its items.

Value

An htmltools tag. With dialog = TRUE, a tag list of the button and the dialog.

Examples

bc_command(
  bc_command_group("Suggestions", "Calendar", "Search Emoji"),
  bc_command_separator(),
  bc_command_item("Profile", shortcut = "CmdP")
)