Menu — a dropdown / context menu that anchors to any target and "just
works". Place <Menu> immediately after the trigger element (a button,
say); it opens on click by default. For a whole-area right-click menu, put
it after the region and pass context.
Open state is uncontrolled by default — listen for onStateChange
(detail: { next, prev }) to observe it, or pass open to control it. You
can also keep a ref and call .open() / .close() / .toggle().
Selecting a MenuItem closes the menu;
arbitrary injected content does not. Add data-menu-open to any item /
container to keep it open, or data-menu-close to a custom element to let it
close.
Requires @antadesign/anta/elements to be imported (client-side only).
Menu — a dropdown / context menu that anchors to any target and "just works". Place
<Menu>immediately after the trigger element (a button, say); it opens on click by default. For a whole-area right-click menu, put it after the region and passcontext.Open state is uncontrolled by default — listen for
onStateChange(detail: { next, prev }) to observe it, or passopento control it. You can also keep arefand call.open()/.close()/.toggle(). Selecting aMenuItemcloses the menu; arbitrary injected content does not. Adddata-menu-opento any item / container to keep it open, ordata-menu-closeto a custom element to let it close.Requires
@antadesign/anta/elementsto be imported (client-side only).