Skip to contents

A button-triggered menu. input$<inputId> is the value of the last activated item. Compose contents from the shad_menu_parts.

Usage

shad_dropdown_menu(
  inputId,
  trigger,
  ...,
  side = c("bottom", "top", "right", "left"),
  align = c("start", "center", "end"),
  class = NULL
)

Arguments

inputId

Input id.

trigger

The tag that opens the menu.

...

Menu parts (items, separators, labels, submenus).

side

"bottom" (default), "top", "right", "left".

align

"start" (default), "center", "end".

class

Extra CSS classes.

Value

A dropdown-menu tag.

Examples

shad_dropdown_menu("m", trigger = shad_button("Open"),
  shad_menu_label("My Account"), shad_menu_separator(),
  shad_menu_item("profile", "Profile", shortcut = "\u21e7\u2318P"))
#> <div data-shad="dropdown-menu" data-align="start" id="m" style="display:inline-block">
#>   <button class="shad-btn shad-btn--default shad-menu__trigger" type="button">Open</button>
#>   <div class="shad-menu__content shad-anim-pop" hidden>
#>     <div class="shad-menu__label">My Account</div>
#>     <div class="shad-menu__separator"></div>
#>     <button type="button" class="shad-menu__item" data-value="profile">
#>       Profile
#>       <span class="shad-menu__shortcut">⇧⌘P</span>
#>     </button>
#>   </div>
#> </div>