Dropdown

Toggleable menu for displaying lists of links and actions.

Basic usage

Hover on the dropdown menu to unfold it for more actions.

The triggering element is rendered by the default slot, and the dropdown part is rendered by the slot named dropdown. By default, dropdown list shows when you hover on the triggering element without having to click it.

Triggering element

Use the button to trigger the dropdown list.

Use split-button to split the triggering element into a button group with the left button being a normal button and right one the actual triggering target. If you wanna insert a separator line between item three and item four, just add a class divider to item four.

Use the attribute trigger. By default, it is hover.

Use hide-on-click to define if menu closes on clicking.

By default menu will close when you click on menu items, and it can be turned off by setting hide-on-click to false.

Command Event

Clicking each dropdown item fires an event whose parameter is assigned by each item.

You can open or close the dropdown menu by manually use handleOpen or handleClose.

Sizes

Besides default size, Dropdown component provides three additional sizes for you to choose among different scenarios.

Use attribute size to set additional sizes with large, default or small.

AttributeDescriptionTypeAccepted ValuesDefault
typemenu button type, refer to Button Component, only works when split-button is truestring
sizemenu size, also works on the split buttonstringlarge / default / smalldefault
max-heightthe max height of menustring / number
split-buttonwhether a button group is displayedbooleanfalse
disabledWhether to disablebooleanfalse
placementplacement of pop menustringtop/top-start/top-end/bottom/bottom-start/bottom-endbottom
triggerhow to triggerstringhover/click/contextmenuhover
hide-on-clickwhether to hide menu after clicking menu-itembooleantrue
show-timeoutDelay time before show a dropdown (only works when trigger is hover)number250
hide-timeoutDelay time before hide a dropdown (only works when trigger is hover)number150
roleThe ARIA role attribute for the dropdown menu. Depending on the use case, you may want to change this to 'navigation'string'menu'
tabindextabindexopen in new window of Dropdownnumber0
popper-classcustom class name for Dropdown's dropdownstring
popper-optionspopper.jsopen in new window parametersObjectrefer to popper.jsopen in new window doc{ boundariesElement: 'body', gpuAcceleration: false }
NameDescriptionSubtags
content of Dropdown. Notice: Must be a valid html dom element (ex. <span>, <button> etc.) or el-component, to attach the trigger listener
dropdowncontent of the Dropdown Menu, usually a <el-dropdown-menu> elementDropdown-Menu
Event NameDescriptionParameters
clickif split-button is true, triggers when left button is clicked
commandtriggers when a dropdown item is clickedthe command dispatched from the dropdown item
visible-changetriggers when the dropdown appears/disappearstrue when it appears, and false otherwise
MethodDescriptionParameters
handleOpenopen the dropdown menu
handleCloseclose the dropdown menu
NameDescriptionSubtags
content of Dropdown MenuDropdown-Item
AttributeDescriptionTypeAccepted ValuesDefault
commanda command to be dispatched to Dropdown's command callbackstring/number/object
disabledwhether the item is disabledbooleanfalse
dividedwhether a divider is displayedbooleanfalse
iconcustom iconstring / Component
NameDescription
customize of Dropdown Item
Last Updated:
Contributors: Tam Mai