Dropdown Menu

Description

A menu of actions in an inline popover beside its trigger.

Usage

bc_dropdown_menu(
  ...,
  id = NULL,
  trigger_label = "Menu",
  trigger = NULL,
  variant = "outline",
  side = NULL,
  align = NULL,
  class = NULL
)

bc_dropdown_item(
  label,
  ...,
  shortcut = NULL,
  icon = NULL,
  disabled = FALSE,
  variant = NULL
)

bc_dropdown_group(title = NULL, ..., heading_id = NULL)

bc_dropdown_separator()

bc_dropdown_checkbox(
  label,
  ...,
  checked = FALSE,
  disabled = FALSE,
  icon = NULL
)

bc_dropdown_radio(label, ..., checked = FALSE, disabled = FALSE, icon = NULL)

Arguments

Argument Description
... Menu content. Strings become menu items, tags pass through and lists are passed to bc_dropdown_item(). Build the rest with bc_dropdown_group(), bc_dropdown_separator(), bc_dropdown_checkbox() and bc_dropdown_radio().
id String. The ID for the dropdown wrapper.
trigger_label String or tag. The trigger button's label.
trigger A tag. A whole trigger, an avatar or anything else, in place of the default button. The wiring attributes are added to it.
variant String. The trigger's button variant.
side String. Placement of the menu beside the trigger. One of top, right, bottom, left, inline-start or inline-end.
align String. Alignment of the menu on its side. One of start, center or end.
class String. Extra classes for the popover.
label String. The item's label.
shortcut String. A shortcut hint shown at the inline end.
icon A tag. An icon before the label.
disabled Bool. Mark the item as disabled.
title String. A group heading shown above its items.
heading_id String. The heading's id and the group's aria-labelledby.
checked Bool. Whether the item starts checked.

Value

A <div class="dropdown-menu"> with a trigger button and the menu popover.

Examples

bc_dropdown_menu(
  bc_dropdown_group(
    "My Account",
    bc_dropdown_item("Profile", shortcut = "CtrP"),
    bc_dropdown_item("Settings", shortcut = "CtrS")
  ),
  bc_dropdown_separator(),
  bc_dropdown_item("Log out")
)

bc_dropdown_menu(
  bc_dropdown_group(
    "Panels",
    bc_dropdown_checkbox("Status bar", checked = TRUE),
    bc_dropdown_checkbox("Activity bar"),
    bc_dropdown_checkbox("Terminal", disabled = TRUE)
  ),
  bc_dropdown_separator(),
  bc_dropdown_group(
    "Position",
    bc_dropdown_radio("Top", checked = TRUE),
    bc_dropdown_radio("Bottom")
  ),
  trigger_label = "View"
)