Skip to content

Dropdown ​

A dropdown list.

When To Use ​

When there are more than a few options to choose from, you can wrap them in a Dropdown. By hovering or clicking on the trigger, a dropdown menu will appear, which allows you to choose an option and execute the relevant action.

Demo ​

Basic Usage ​

Placements ​

The dropdown can be positioned relative to the trigger element. Possible positions are: top-start, top-end, bottom-end, bottom-start.

You can also use the positions attribute to set all preferred position of the dropdown. On scroll, the dropdown will be repositioned to the closest position.

API ​

Properties ​

PropertyAttributeDescriptionTypeDefault
disableddisabledWhether to disable the drop-down menubooleanfalse
managedmanagedIs it controlled mode? In controlled mode, the state of the component is completely controlled externally.booleanfalse
openopenIs the drop-down menu open?booleanfalse
placementsplacementsDrop-down menu location options Multiple locations are separated by commas and sorted by prioritystring'bottom-start,top-start,bottom-end,top-end'
triggertriggerHow to trigger the drop-down menu
1. click: click trigger
2. hover: hover trigger
3. manual: manual control
"click" | "hover" | "manual"'click'

Events ​

EventDescriptionType
zane-dropdown--closeDrop-down menu close eventCustomEvent<any>
zane-dropdown--item-clickMenu item click eventCustomEvent<any>
zane-dropdown--openDrop-down menu open eventCustomEvent<any>

CSS Custom Properties ​

NameDescription
--zane-dropdown-menu-max-heightMaximum height of the menu

Released under the MIT License.