Dropdown Menu
Description
Create a menu of actions that opens from a button.
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, id = NULL)
bc_dropdown_separator()
bc_dropdown_checkbox(
label,
...,
checked = FALSE,
disabled = FALSE,
icon = NULL,
id = NULL
)
bc_dropdown_radio(label, ..., checked = FALSE, disabled = FALSE, icon = NULL)
Arguments
| Argument | Description |
|---|---|
... |
For bc_dropdown_menu() and bc_dropdown_group(), menu items from bc_dropdown_item(), bc_dropdown_group(), bc_dropdown_separator(), bc_dropdown_checkbox() and bc_dropdown_radio(). A string becomes an item, and a list is passed to bc_dropdown_item() as its arguments. For the item functions, extra tag attributes. |
id |
String. The ID. bc_dropdown_menu() uses a random ID by default. With bc_shiny_deps(), input$id is TRUE or FALSE for a bc_dropdown_checkbox(), and the label of the checked bc_dropdown_radio() for a bc_dropdown_group(). |
trigger_label |
String. The button's label. Defaults to "Menu". |
trigger |
Tag, such as an avatar, that opens the menu in place of the default button. |
variant |
String. For bc_dropdown_menu(), the button variant from bc_button(). Defaults to "outline". For bc_dropdown_item(), "destructive" or NULL. |
side |
String. Where the menu opens next to the button. One of "top", "right", "bottom", "left", "inline-start" or "inline-end". |
align |
String. Alignment of the menu along that side. One of "start", "center", or "end". |
class |
String. Extra CSS classes for the menu. |
label |
String. The item's label. |
shortcut |
String. A shortcut hint shown at the end of the item. |
icon |
Tag. An icon before the label. |
disabled |
Bool. Whether the item is disabled. Defaults to FALSE. |
title |
String. A group title shown above its items. |
heading_id |
String. The ID of the group title. Defaults to a random ID. |
checked |
Bool. Whether the item starts checked. Defaults to FALSE. |
Value
An htmltools tag.
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"
)