Docs Components Dropdown
Dropdown
The <velin-dropdown> Web Component displays a toggleable menu anchored to a
trigger element, with start/end alignment, type-ahead search, and full keyboard navigation (0.7.0).
Basic Example
Preview HTML
Open Menu
Profile
Settings
Sign out
Copy
<velin-dropdown>
<button class="velin-btn velin-btn--primary" slot="trigger">
Open Menu
</button>
<button role="menuitem">Profile</button>
<button role="menuitem">Settings</button>
<button role="menuitem">Sign out</button>
</velin-dropdown>
End Alignment
Preview HTML
Copy
<velin-dropdown align="end">
<button slot="trigger">Align End</button>
<button role="menuitem">Item A</button>
<button role="menuitem">Item B</button>
</velin-dropdown>
Keyboard Navigation
Key Action
Enter / Space Toggle menu (on trigger), activate item
Arrow Down Focus next menu item
Arrow Up Focus previous menu item
Home Focus first item
End Focus last item
Letter / digit keys Type-ahead: focus first item whose label starts with the typed string (500 ms window)
Escape Close menu, return focus to trigger
Accessibility
Menu behaviour follows the menu button pattern .
Trigger gets aria-haspopup="menu", aria-expanded, and aria-controls (menu id).
Menu panel has role="menu"; items use role="menuitem" (assigned automatically if omitted).
Roving tabindex with arrow keys; first item is focused when the menu opens.
Type-ahead focuses the first matching item by visible label (WAI-ARIA menu pattern).
Escape closes the menu and returns focus to the trigger; outside click closes as well.
Menu items use a minimum block size of 2.5 rem; animations respect prefers-reduced-motion.
CSS Variables
Variable Description
--velin-z-dropdownz-index (100)
--velin-color-surface-brightMenu background
--velin-color-borderMenu border
--velin-radius-mdMenu border radius
--velin-shadow-lgMenu shadow
JavaScript API
Attributes
Attribute Type Description
openBoolean Whether the menu is visible
alignString start (default) or end
Methods
Method Description
toggle()Toggle open/close
open()Open the menu
close()Close the menu
Events
Event Description
velin-closeFired when the menu closes
Previous Drawer
Next Lightbox