Menu

Menu is a versatile component for creating navigation lists and hierarchical menus. It supports different sizes, orientations, and can be combined with other components to create complex navigation structures.

Basic Usage

Code Example
Basic.vue

Components

The Menu components include the following:

  • Menu - A component for creating navigation lists and hierarchical menus.
  • MenuItem - Renders a menu item within a Menu component.
  • MenuTitle - Renders a title within a Menu component.
  • MenuExpand - Creates an expandable submenu section.
  • MenuExpandToggle - Toggles the state of a MenuExpand component.

The Menu component renders a ul element with a menu class. It can be used to create vertical or horizontal navigation menus with various size options.

Menu Props Type Description
align
string

Sets the menu alignment to vertical or horizontal.

   
vertical
boolean

Sets alignment to vertical.

   
horizontal
boolean

Sets alignment to horizontal.

size
string

Sets the menu size. Options: - xl - lg - md - sm - xs

   
xl
boolean

Sets size to xl.

   
lg
boolean

Sets size to lg.

   
md
boolean

Sets size to md.

   
sm
boolean

Sets size to sm.

   
xs
boolean

Sets size to xs.

Menu Slots Description
default

The default slot. Content to be displayed inside the menu. Typically contains MenuItem components.

The MenuItem component renders an li element with a menu-item class. While it's possible to use any content inside, to achieve the "list of menu items" look, place an a or span element inside for correct styling.

MenuItem Props Type Description
active
boolean

Styles the menu item to stand out.

disabled
boolean

Styles the menu item to look disabled. Also updates the mouse cursor to show that the action is not allowed.

MenuItem Slots Description
default

The default slot. Content to be displayed inside the menu item. Typically contains an a or span element.

The MenuTitle component renders an li element with a menu-title class. It does not have any props.

MenuTitle Slots Description
default

The default slot. Content to be displayed as the menu title.

The MenuExpand component renders a details element with a dropdown menu-expand class. It can be used to create expandable submenu sections.

MenuExpand Props Type Description
open
boolean
v-model Allows manual control of the open/closed state.
hover
boolean

Opens the dropdown on mouseover. Closes on mouseout.

   
delay-enter
number

Changes the hover wait time before the Dropdown opens. default: 0.

   
delay-leave
number

Changes the mouseout wait time before the Dropdown closes. default: 300.

close-on-click-outside
boolean

Closes the dropdown when clicking outside of the element.

random-id
string

Allows manually specifying the internal random id. This is required for SSR.

MenuExpand Events Arguments Description
update:open
v-model Allows manual control of the open/closed state.
MenuExpand Slots Description
default

The default slot. Must contain a MenuExpandToggle component and content to be displayed when expanded.

MenuExpand Provides Type Description
menuExpandState
Object

An object containing the expand state and control functions: - id: The unique ID of the expand element - isOpen: Whether the expand is open or closed - toggle: Function to toggle the expand state - open: Function to open the expand - close: Function to close the expand

The MenuExpandToggle component goes inside of a MenuExpand component. It toggles the state of the expand when clicked. It renders a summary element with a menu-expand-toggle class.

MenuExpandToggle Slots Description
default

The default slot. Content to be displayed inside the toggle element.

Examples

Unstyled Menu

A menu without additional styling.

Code Example
Unstyled.vue

A menu where one item is styled as menu-active.

Code Example
Active.vue

Disabled Item

A menu with a disabled item. The disabled prop styles the menu item to look disabled but does not prevent click events on nested elements.

Code Example
DisabledItem.vue

Menus with different size options using the size prop or shortcut props.

Code Example
Size.vue

Responsive Size

Menus with responsive sizing using Tailwind's responsive classes.

Code Example
ResponsiveSize.vue

Horizontal Menu

A horizontal menu layout.

Code Example
Horizontal.vue

With Icons

A menu with icons for each item.

Code Example
WithIcons.vue

Only Icons

A menu with only icons as items.

Code Example
OnlyIcons.vue

Only Icons Horizontal

A horizontal menu with only icons as items.

Code Example
OnlyIconsHorizontal.vue

Horizontal with Submenu

A horizontal menu with an always-open submenu.

Code Example
HorizontalWithSubmenu.vue

With Custom Color

A menu with custom background and text color classes.

Code Example
WithCustomColor.vue

Vertical with Submenus

A vertical menu with nested submenus.

Vertical Menu With Expandable Submenus

A vertical menu using MenuExpand for expandable submenus.

Code Example
WithVerticalExpand.vue

Vertical Menu with a Dropdown

A vertical menu using the Dropdown component for inline dropdowns.

Code Example
ExampleMenuWithDropdown.vue