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.

Placement

Support 6 placements.

Set placement property to make dropdown appear in different locations.

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.

How to trigger

Click the triggering element or hover on it.

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

hover to trigger
click to trigger
right click to trigger

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

open(close) the Dropdown list2 will close(open) the Dropdown List1.

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.

NameDescriptionTypeDefault
typemenu button type, refer to Button Component, only works when split-button is trueenum''
sizemenu size, also works on the split buttonenum''
max-heightthe max height of menustring / number''
split-buttonwhether a button group is displayedbooleanfalse
disabledwhether to disablebooleanfalse
placementplacement of pop menuenumbottom
triggerhow to triggerenumhover
triggerKeys 2.9.1specify whick keys on the keyboard can trigger when pressedarray['Enter', 'Space', 'ArrowDown', 'NumpadEnter']
hide-on-clickwhether to hide menu after clicking menu-itembooleantrue
show-timeoutdelay time before show a dropdown (only works when trigger is hover)number150
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'stringmenu
tabindextabindex of Dropdownnumber / string0
popper-classcustom class name for Dropdown's dropdownstring''
popper-optionspopper.js parametersobject{modifiers: [{name: 'computeStyles',options: {gpuAcceleration: false}}]}
teleported 2.2.20whether the dropdown popup is teleported to the bodybooleantrue
NameDescriptionSubtags
defaultcontent 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
NameDescriptionType
clickif split-button is true, triggers when left button is clickedFunction
commandtriggers when a dropdown item is clicked, the parameters is the command dispatched from the dropdown itemFunction
visible-changetriggers when the dropdown appears/disappears, the param is true when it appears, and false otherwiseFunction
MethodDescriptionType
handleOpenopen the dropdown menuFunction
handleCloseclose the dropdown menuFunction
NameDescriptionSubtags
defaultcontent of Dropdown MenuDropdown-Item
NameDescriptionTypeDefault
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
defaultcustomize of Dropdown Item

Source

ComponentStyleDocs

Contributors