Menu

Menu that provides navigation for your website.

TIP

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

Top bar

Top bar Menu can be used in a variety of scenarios.

Left And Right

Vertical Menu with sub-menus.

Collapse

Vertical Menu could be collapsed.

Popper Offset 2.4.4

Menu with popperOffset will override Submenu's popper-offset.

NameDescriptionTypeDefault
modemenu display modeenumvertical
collapsewhether the menu is collapsed (available only in vertical mode)booleanfalse
ellipsiswhether the menu is ellipsis (available only in horizontal mode)booleantrue
ellipsis-icon 2.4.4custom ellipsis icon (available only in horizontal mode and ellipsis is true)string / Component
popper-offset 2.4.4offset of the popper (effective for all submenus)number6
background-color deprecatedbackground color of Menu (hex format) (deprecated, use --bg-color instead)string#ffffff
text-color deprecatedtext color of Menu (hex format) (deprecated, use --text-color instead)string#303133
active-text-color deprecatedtext color of currently active menu item (hex format) (deprecated, use --active-color instead)string#409eff
default-activeindex of active menu on page loadstring''
default-openedsarray that contains indexes of currently active sub-menusobject[]
unique-openedwhether only one sub-menu can be activebooleanfalse
menu-triggerhow sub-menus are triggered, only works when mode is 'horizontal'enumhover
routerwhether vue-router mode is activated. If true, index will be used as 'path' to activate the route action. Use with default-active to set the active item on load.booleanfalse
collapse-transitionwhether to enable the collapse transitionbooleantrue
popper-effect 2.2.26Tooltip theme, built-in theme: dark / light when menu is collapsedenumdark
close-on-click-outside 2.4.4optional, whether menu is collapsed when clicking outsidebooleanfalse
popper-class 2.5.0custom class name for all popup menusstring
show-timeout 2.5.0control timeout for all menus before showingnumber300
hide-timeout 2.5.0control timeout for all menus before hidingnumber300
NameDescriptionType
selectcallback function when menu is activatedFunction
opencallback function when sub-menu expandsFunction
closecallback function when sub-menu collapsesFunction
NameDescriptionSubtags
defaultcustomize default contentSubMenu / Menu-Item / Menu-Item-Group
NameDescriptionType
openopen a specific sub-menu, the param is index of the sub-menu to openFunction
closeclose a specific sub-menu, the param is index of the sub-menu to closeFunction
NameDescriptionTypeDefault
index requiredunique identificationstring
popper-classcustom class name for the popup menustring
show-timeouttimeout before showing a sub-menu(inherit show-timeout of the menu by default.)number
hide-timeouttimeout before hiding a sub-menu(inherit hide-timeout of the menu by default.)number
disabledwhether the sub-menu is disabledbooleanfalse
teleportedwhether popup menu is teleported to the body, the default is true for the level one SubMenu, false for other SubMenusbooleanundefined
popper-offsetoffset of the popper (overrides the popper of menu)number
expand-close-iconIcon when menu are expanded and submenu are closed, expand-close-icon and expand-open-icon need to be passed together to take effectstring / Component
expand-open-iconIcon when menu are expanded and submenu are opened, expand-open-icon and expand-close-icon need to be passed together to take effectstring / Component
collapse-close-iconIcon when menu are collapsed and submenu are closed, collapse-close-icon and collapse-open-icon need to be passed together to take effectstring / Component
collapse-open-iconIcon when menu are collapsed and submenu are opened, collapse-open-icon and collapse-close-icon need to be passed together to take effectstring / Component
NameDescriptionSubtags
defaultcustomize default contentSubMenu / Menu-Item / Menu-Item-Group
titlecustomize title content
NameDescriptionTypeDefault
indexunique identificationstring / nullnull
routeVue Router objectobject
disabledwhether disabledbooleanfalse
NameDescriptionType
clickcallback function when menu-item is clicked, the param is menu-item instanceFunction
NameDescription
defaultcustomize default content
titlecustomize title content
NameDescriptionTypeDefault
titlegroup titlestring
NameDescriptionSubtags
defaultcustomize default contentMenu-Item
titlecustomize group title

Type Declarations

Show declarations
ts
/**
 * @param index index of activated menu
 * @param indexPath index path of activated menu
 * @param item the selected menu item
 * @param routerResult result returned by `vue-router` if `router` is enabled
 */
type MenuSelectEvent = (
  index: string,
  indexPath: string[],
  item: MenuItemClicked,
  routerResult?: Promise<void | NavigationFailure>
) => void

/**
 * @param index index of expanded sub-menu
 * @param indexPath index path of expanded sub-menu
 */
type MenuOpenEvent = (index: string, indexPath: string[]) => void

/**
 * @param index index of collapsed sub-menu
 * @param indexPath index path of collapsed sub-menu
 */
type MenuCloseEvent = (index: string, indexPath: string[]) => void

interface MenuItemRegistered {
  index: string
  indexPath: string[]
  active: boolean
}

interface MenuItemClicked {
  index: string
  indexPath: string[]
  route?: RouteLocationRaw
}

Source

ComponentStyleDocs

Contributors