← Back to Components
Dropdown Menu
Portal-rendered action menu with items, labels, separators, and event-style value reporting.
Interactive Playground
R Code
API Reference
block_dropdown_menu()
Portal-rendered action menu built from item/label/separator parts; choosing an item reports its value to input$id as an event.
| Argument | Type | Default | Description |
|---|---|---|---|
| trigger | character | shiny.tag | required | Trigger label string or an arbitrary tag (icon button, avatar). |
| ... | menu parts | required | dropdown_menu_item(), dropdown_menu_label(), dropdown_menu_separator(). |
| id | character | NULL | Optional input id; input$id reports the chosen item value as an event. |
| label | character | NULL | Accessible name for the trigger; recommended for icon-only triggers. |
| side | 'bottom' | 'top' | 'left' | 'right' | 'bottom' | Side of the trigger to anchor on. |
| align | 'start' | 'center' | 'end' | 'start' | Alignment along the anchored side. |
| trigger_variant | character | 'outline' | Button variant for a string trigger. |
| disabled | logical | FALSE | Whether the trigger is disabled. |
| style | character | list | NULL | Inline styles on the menu content container. |
| class | character | NULL | Additional classes on the menu content container. |
dropdown_menu_item()
A selectable action row. Choosing it reports its value to the parent menu's input$id.
| Argument | Type | Default | Description |
|---|---|---|---|
| value | character | required | Value reported to the parent menu's input$id. |
| label | character | value | Item label. |
| icon | character | shiny.tag | NULL | Optional leading icon. |
| shortcut | character | NULL | Right-aligned keyboard-shortcut hint (display only). |
| disabled | logical | FALSE | Whether the item is non-interactive. |
| variant | 'default' | 'destructive' | 'default' | Item visual variant. |
update_block_dropdown_menu()
Server-driven update: replace items, open/close, reposition, disable, or restyle the menu.
| Argument | Type | Default | Description |
|---|---|---|---|
| session | ShinySession | required | Active R/Shiny session. |
| input_id | character | required | Dropdown-menu input id. |
| items | menu parts | - | Replacement menu parts. |
| open | logical | - | Programmatically open/close the menu. |