Skip to content
On this page

Menu

Basic

AMenu allows creating menu with various options to customize the behavior.

Trigger

To open menu on hover use set trigger prop to hover.

v-model support

AMenu also support v-model to show/hide menu.

Persistence

Use persist prop to adjust the persistence of menu.

Default value is false, it will close the menu on any click. Set it to true to persist it on outside click. You can use persist="content" to persist menu to content only, means if you click on content menu won't close however outside click of content will close the menu.

Transition

AMenu also support transition. Default transition is slide-y. Set it to available transition to use different transition. e.g. transition="fade".

To disable the transition you can set transition prop to null.

Placement

As AMenu uses Floating UI, you can configure how menu is rendered.

To adjust the placement of menu, use placement prop. This will get directly passed to Floating UI as show in their docs.

✨ Auto Placement

If there's not enough space to render the menu on given position then it will update the position according to available space.

Strategy

Set which positioning strategy to use to render the menu. This is also Floating UI option, for more details please read the official docs here.

Middleware

AMenu has some middleware as default to render the menu content correctly. You can also customize the middleware you want.

In below demo we are not using any middleware so menu component won't behave like above menu contents. e.g. Flipping menu content if there's not enough space won't work.

middleware prop accepts function that must return array of middleware. Please refer to the code snippet of this demo for function signature.

You can read more about middleware on their official docs.

API

Menu

modelValue : boolean

Show/Hide floating element base on v-model value

persist : boolean | "content"

Persistence of floating element when clicked outside of reference element

trigger : "click" | "hover"

Trigger event to open the floating element

delay : number

Delay before showing floating element

hideDelay : number

Delay before hiding floating element

transition : LiteralUnion<"fade" | "scale" | "slide-y" | "slide-y-reverse" | "scroll-y" | "scroll-y-reverse" | "slide-x" | "slide-x-reverse" | "scroll-x" | "scroll-x-reverse" | "view-next" | "view-previous", string> | null

Transition to add while showing/hiding floating element

placement : Placement

Placement option from Floating UI

strategy : Strategy

Strategy option from Floating UI

middleware : AFloatingMiddlewareFunc

Middleware option from Floating UI

default : any

Default slot for rendering menu content Generally, you will use AList component here.

Released under the MIT License.