Dropdown

Toggleable menu for displaying lists of links and actions.

TIP

This component requires the <client-only></client-only> wrap when used in SSR (eg: Nuxt) and SSG (eg: VitePress).

Basic usage

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

Triggering element

Use the button to trigger the dropdown list.

How to trigger

Click the triggering element or hover on it.

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

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.

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
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