BetaPublic beta — Read the release notes
Documentation

Menu

Action list triggered by a button.

Package
@solidiom/menu
Version
0.0.1-next.0
Status
stable

Preview

This preview uses documentation-only styling. Ship with one of the included recipe outputs (CSS, Tailwind, or UnoCSS) for production styles.

Action list triggered by a button.

Usage

Compose Root, Trigger, Content, Item, Separator, CheckboxItem, RadioGroup, RadioItem, Label, Sub, SubTrigger, SubContent.

import * as Menu from "@solidiom/menu"

;<Menu.Root>Menu content</Menu.Root>

Installation

Install the package with pnpm add @solidiom/menu. The package requires compatible solid-js and @solidjs/web peer dependencies.

Parts

Menu exposes 12 parts:

  • Rootdata-part="root".
  • Triggerdata-part="trigger".
  • Contentdata-part="content".
  • Itemdata-part="item".
  • Separatordata-part="separator".
  • CheckboxItemdata-part="checkboxitem".
  • RadioGroupdata-part="radiogroup".
  • RadioItemdata-part="radioitem".
  • Labeldata-part="label".
  • Subdata-part="sub".
  • SubTriggerdata-part="subtrigger".
  • SubContentdata-part="subcontent".

Styling

Menu carries data-scope="menu" and data-part attributes on each part for CSS/recipe targeting. State attributes like data-state, data-disabled, and data-highlighted are exposed where applicable.

Keyboard & behavior

KeyBehavior
ArrowDownMoves focus to the next menu item.
ArrowUpMoves focus to the previous menu item.
Enter/SpaceActivates the focused menu item.
EscapeCloses the menu and returns focus to the trigger.
ArrowRightOpens a sub-menu when focus is on a sub-trigger.
ArrowLeftCloses the sub-menu and returns focus to the parent.

Composition

Menu is designed to compose with other primitives. Its parts can be combined with Field, Button, or other primitives as needed.

SSR and hydration

Menu renders as semantic HTML during server rendering. Interactive behavior (keyboard handlers, state management) activates on hydration without layout shift.