Feedback & overlays / Menu

Feedback & overlays

Menu

A popup list anchored to the control that opened it: actions, a checklist, a single choice with a tick, or a long checklist under a fixed footer.

import { EcoMenu } from "vue-ecosphere"

Account menu

Actions close the menu. Arrow keys, Home and End move between entries; Escape closes and returns focus.

Filter menu

A checklist toggles without closing, so several entries change in one visit.

Range menu

A single choice marks the current value with a tick and closes on choosing.

Long checklist, fixed footer

A table's column chooser: the entries scroll, and Compact rows stays in reach underneath.

API

NameTypeDefaultDescription
itemsEcoMenuItem[]—{ type?: 'item' | 'checkbox' | 'radio' | 'separator' | 'head', label, value?, icon?, danger?, disabled? }. Or write menu__opt buttons in the default slot.
v-model:openbooleanfalseOpen state (menu.is-open). Escape and an outside click close it; Escape returns focus to the trigger.
v-model:checked(string | number)[][]Values of the ticked checkbox entries. Checklist entries toggle without closing.
v-model:selectedstring | number—Value of the chosen radio entry (tick); choosing closes the menu.
align"left" | "right""left"right → menu--right, aligned to the trigger's right edge. A single-choice menu (radio items) is a rangemenu and always opens from the right edge.
widebooleanfalsemenu--wide (320px).
scrollbooleanfalsemenu--scroll: entries scroll in menu__scroll under a fixed menu__foot.
headstring—Uppercase caption (menu__head). The #head slot replaces it (e.g. menu__who).
#triggerslot { attrs, open, toggle }—Bind attrs to your button: aria-haspopup, aria-expanded, aria-controls, click and ArrowDown/ArrowUp to open.
#footslot { close }—menu__foot (split layout unless scroll).
@select(item) => void—An entry was chosen.