VOOZH about

URL: https://quasar.dev/vue-components/menu/

⇱ QMenu | Quasar Framework


assignment_late
Why donate
travel_explore
API Explorer
build
Quasar CLI (with Vite)
Upgrade Guide
Creating a New Project
The /quasar.config File
Convert q/app-webpack Project
Browser Compatibility
TypeScript Support
Directory Structure
Commands List
CSS Preprocessors
Page Routing with VueRouter
Lazy Loading - Code Splitting
Handling Assets
Boot Files
Prefetch Feature
API Proxying
Handling Vite
Handling import.meta.env
State Management with Pinia
Lint and Format Code
Testing & Auditing
Developing Mobile Apps
Ajax Requests
Opening Dev Server To Public
build
Quasar CLI (with Webpack)
QMenu

The QMenu component is a convenient way to show menus. Goes very well with QList as dropdown content, but it’s by no means limited to it.

Loading QMenu API...

Usage

The idea with QMenu is to place it inside your DOM element / component that you want to be the trigger as direct child. Don’t worry about QMenu content inheriting CSS from the container as the QMenu will be injected as a direct child of <body> through a Quasar Portal.

TIP

Don’t forget to use the directive v-close-popup in your clickable menu items if you want the menu to close automatically. Alternatively, you can use the QMenu’s property auto-close or handle closing the menu yourself through its v-model.

Basic

Basic


Idea for content


Toggle through v-model


WARNING

If you want to conditionally activate or de-activate a QMenu, please use v-if on it instead of v-show.

Submenus

Menus in menus


Sizing and styling

Sizing


Style


Context menu

You can also set QMenu to act as a context menu. On desktop, you need to right click the parent target to trigger it, and on mobile a long tap will do the job.

Context Menu


Persistent

If you want the QMenu to not close if app route changes or if hitting ESCAPE key or if clicking/tapping outside of the menu, then use persistent prop:

Persistent


Transitions

In the example below there’s a few transitions showcased. For a full list of transitions available, go to Transitions.

Transition examples


Reusable

The example below shows how to create a re-usable menu that can be shared with different targets.

Using target


Positioning

Position examples


The position of QMenu can be customized. It keeps account of the anchor and self optional props. The final position of QMenu popup is calculated so that it will be displayed on the available screen real estate, switching to the right-side and/or top-side when necessary.

For horizontal positioning you can use start and end when you want to automatically take into account if on RTL or non-RTL. start and end mean “left” for non-RTL and “right” for RTL.


Fit
Cover
Anchor Origin
Vertical
Top
Center
Bottom
Horizontal
Left
Middle
Right
Start
End
Self Origin
Vertical
Top
Center
Bottom
Horizontal
Left
Middle
Right
Start
End

<q-menu anchor="bottom left" self="top left">
 <q-item clickable>
 <q-item-section>New tab</q-item-section>
 </q-item>
 <q-item clickable>
 <q-item-section>New incognito tab</q-item-section>
 </q-item>
</q-menu>

Caught a mistake?Edit this page in browser
1. Introduction
2. QMenu API
3. Usage
3.1. Basic
3.2. Submenus
3.3. Sizing and styling
3.4. Context menu
3.5. Persistent
3.6. Transitions
3.7. Reusable
3.8. Positioning
Copyright © 2015-present PULSARDEV SRL, Razvan Stoenescu