Skip to content

Dropdown — wd-dropdown

Category: Navigation · Tag: wd-dropdownBack to: Components overview


What it does

A button that opens a menu. You set the button label and place the menu items inside; clicking the button toggles the menu (built on the native popover, so it closes on outside-click automatically).


Adding it & its settings

Add Component → Navigation → Dropdown.

Basic Settings (all components): #id, Classes, Inline Style.

Component Settings:

SettingTypeEffect
Button TexttextThe label shown on the trigger button.

Content & slots

  • Default slot — the menu items (e.g. links). They appear in the popover menu.
html
<wd-dropdown><!-- Button Text set to "Menu" in settings -->
  <a href="/profile">Profile</a>
  <a href="/settings">Settings</a>
  <a href="/logout">Log out</a>
</wd-dropdown>

Styling

CSS variables

Trigger button

VariableDefault
--dropdown-button-background#f0f0f0
--dropdown-button-hover-background#e0e0e0
--dropdown-button-color#333
--dropdown-button-padding0.5rem 1rem
--dropdown-button-bordernone
--dropdown-button-border-radius0.25rem
--dropdown-button-font-familysans-serif
--dropdown-button-font-size1rem
--dropdown-button-font-weightnormal
--dropdown-button-transitionall 0.3s ease

Menu (popover)

VariableDefault
--dropdown-menu-background#fff
--dropdown-menu-border1px solid #e6e6e6
--dropdown-menu-border-radius0.25rem
--dropdown-menu-padding0.5rem
--dropdown-menu-min-widthauto
--dropdown-menu-widthmax-content
--dropdown-menu-inset0
--dropdown-menu-box-shadow0 2px 5px rgba(0,0,0,0.15)
--dropdown-menu-flex-directioncolumn
--dropdown-menu-gap0.5rem
--dropdown-menu-popover-open-displaygrid

::part()

PartElement
dropdown-<id>The dropdown wrapper (button + menu).
css
wd-dropdown::part(dropdown-user) { font-weight: 600; }

Notes

  • Menu items are your own slotted elements (in the light DOM), so you can style them with ordinary page CSS as well as the variables above.