--- ## Menu Action menu (`role="menu"`) triggered by a button, with nested submenus, sections, icons, and separators. Items are verbs the user can invoke — Edit, Delete, Share, Export — and dispatch an `onSelect` callback when activated. An item given `checked` additionally *shows* a setting: it renders as `role="menuitemradio"` with the supplied state announced and marked. Menu still owns no selection state — the consumer computes `checked` and updates it from `onSelect`. For committing a value to a form use `Select` (or `Combobox` for searchable). Menu and Select stay deliberately disjoint: Menu's `role="menu"`/`menuitem` semantics with arrow-key roving and Action-family chrome versus Select's `role="listbox"` value commitment with Form-family chrome. **Import:** `import { Menu } from '@urbicon-ui/blocks';` ### Examples ```svelte edit() }, { label: 'Duplicate', onSelect: () => duplicate() }, { type: 'section', label: 'Danger' }, { label: 'Delete', onSelect: () => confirmDelete() } ]} /> ``` ```svelte rename()}>Rename duplicate()}>Duplicate confirmDelete()}>Delete ``` ```svelte (sortBy = 'Name') }, { label: 'Date', checked: sortBy === 'Date', onSelect: () => (sortBy = 'Date') } ] }, { label: 'Refresh', onSelect: () => refresh() } ]} /> ``` ```svelte {#snippet customTrigger(toggle, open)} {/snippet} ``` ### Variants - chevronAnimation: fade, none, rotate, translate (default: rotate) - disabled: true - itemSize: lg, md, sm (default: md) - open: true (default: false) - placement: bottom, bottom-end, bottom-start, top, top-end, top-start (default: bottom-start) - syncWidth: false, true (default: true) - false — The panel ignores the trigger and takes a 12rem minimum width instead — in a context menu as well — so it can end up narrower than a wide trigger. - true — The panel is at least as wide as the trigger, and longer items widen it. A context menu has no trigger, so its panel is as wide as its items. - tier: commit, modify (default: commit) - usePortal: false, true (default: true) ### Api | Prop | Type | Required | Default | Description | | --- | --- | :---: | --- | --- | | ...HTMLAttributes | `HTMLAttributes` | no | | HTML attributes (excluding: 'children' | 'class' | 'placeholder') | | ...MenuVariants | `VariantProps` | no | | Styling variants from MenuVariants | | chevronAnimation | `'rotate' | 'translate' | 'fade' | 'none'` | no | | chevronAnimation property | | children | `Snippet` | no | | Declarative children mode — use `` / `` / ``. A `` wraps the items it names, the same way a `{ type: 'section' }` entry owns the items that follow it. | | class | `string` | no | | class property. In the same Tailwind bucket `class` wins over the `slotClasses` entry for the element it lands on. Presets and provider defaults sit below both. | | contextTrigger | `Snippet` | no | | Turn the menu into a **context menu**: instead of a trigger button, the snippet you pass becomes a right-click target. A `contextmenu` (right-click or long-press) on it opens the menu at the cursor position — the native browser context menu is suppressed. Keyboard navigation, dismissal and item selection behave exactly as in the dropdown menu; on dismiss, focus returns to wherever it was. Mutually exclusive with `customTrigger`/the default trigger button (when set, no trigger button renders). | | customFooter | `Snippet` | no | | Optional custom footer rendered below the items list. | | customHeader | `Snippet` | no | | Optional custom header rendered above the items list. | | customItem | `Snippet<[TItem]>` | no | | Custom per-item content. **Render visible content only** — the outer `role="menuitem"` button is provided by Menu and handles the click / keyboard activation. Putting an interactive element (`