--- name: menu-usage description: > Use after component-usage-ux when an app needs @techsio/ui-kit Menu for action, radio, checkbox, separator, or submenu items using the Zag.js menu wrapper, Button trigger, icons, and supported open/highlight/select props. metadata: component_version: "1.5.0" type: "core" library: "@techsio/ui-kit" library_version: "0.3.2" requires: "component-usage-ux app-token-overrides ux-guidelines" resources: "references/ux.md ../../references/component-contracts.md ../../references/consumer_app_usage_rules.md" sources: "https://zagjs.com/components/react/menu" contributor_sources: "libs/ui/src/molecules/menu.tsx libs/ui/src/tokens/components/molecules/_menu.css libs/ui/stories/molecules/menu.stories.tsx libs/ui/src/molecules/menu.figma.ts" audience: "consumer" --- > Portable scope: Use the installed package's exported types and bundled sibling skills. Repository source paths are optional contributor evidence, not consumer prerequisites; use the consuming app's own checks. Resolve ../../references/ paths from this skill's folder, not the app working directory. # @techsio/ui-kit Menu Usage Use Menu for contextual command lists. Use Select for choosing a value in a form, Tabs for switching panels, and Popover for custom content. ## UX/UI guidelines House rules come from the `ux-guidelines` skill (writing, formatting, states, where actions and feedback live). This section applies them to `Menu`. **Use it when** - A list of commands for one object or context: row `More actions`, account menu, overflow of page actions. **Use something else when** | Need | Use instead | | --- | --- | | Choosing a value in a form | Select | | Switching views | Tabs | | Custom content (forms, pickers) | Popover | | Searching many commands | Command | **Do** - Order items by frequency; group with separators; destructive items last, with a label that names the consequence (menu items have no danger tone). - Label items as verbs (`Duplicate`, `Archive`, `Delete…`); `…` when the item opens a dialog asking for more input. - Show shortcuts with Hotkeys when they exist. - Disable an unavailable item only if the reason is obvious; otherwise hide it. **Don't** - Put navigation and commands in one flat list without grouping. - Nest menus more than one level. **Copy and states** - Trigger for overflow: ActionIcon with `aria-label="More actions"`. **Behaviour (from the UX spec)** - Opening the menu or highlighting an item runs nothing; only activation does. Closing without choosing changes nothing. - The app confirms the result on the object or with a toast, never inside the menu. - Use `link` items for navigation and `action` items for commands, in separate groups. **Figma → code** | Figma | Code | | --- | --- | | `size=sm\|md\|lg` | `size` (`xs` is legacy, DataTable only) | | menu-trigger / submenu / check glyphs | `triggerIcon`, `submenu` items, `checkbox`/`radio` items | Full UX page (anatomy, states, behaviour, edge cases): [references/ux.md](references/ux.md). The same page renders in Storybook as *Molecules/Menu → UX guidelines*. ## Setup ```tsx import { Menu, type MenuItem } from "@techsio/ui-kit/molecules/menu" const items: MenuItem[] = [ { type: "action", value: "edit", label: "Edit", icon: "token-icon-edit" }, { type: "separator", id: "main" }, { type: "action", value: "delete", label: "Delete" }, ]