Skip to Content

Menu

Menu renders a raised Windows 98 command menu. Use MenuItem for actions and MenuSeparator for grouped commands. For nested commands, wrap a trigger and content pair in MenuSub to get a side-expanding submenu.

Props

ExportKey propsDescription
MenuHTML menu propsRoot command list with role="menu".
MenuItemicon, disabled, selected, reserveIconSpaceInteractive or disabled menu row.
MenuSeparatorHTML li propsHorizontal divider between command groups.
MenuSubopen, onOpenChange, hoverOpenDelay, hoverCloseDelayOwns submenu open state and hover timers.
MenuSubTriggericon, disabled, reserveIconSpaceMenu row that opens a submenu, with a built-in right-side chevron.
MenuSubContentsideOffset, plus Menu propsPortal-rendered submenu positioned to the right of the trigger, flipping to the left at the viewport edge.

Examples

Command menu

Submenus

Scroll-arrow steppers

Viewport edge detection

Hover Accessories

ARIA

Menu uses role="menu"; each item uses role="menuitem", and disabled items expose aria-disabled. MenuSubTrigger adds aria-haspopup="menu" and toggles aria-expanded as the submenu opens. Enabled menu items are focusable and skip disabled rows during roving navigation.

Keyboard

ArrowUp and ArrowDown move focus between enabled menu items and wrap at the ends. Home and End move to the first and last enabled item. Typing printable characters moves focus to the next enabled item whose text starts with the typed buffer. Enter and Space activate the focused menu item. On a MenuSubTrigger, ArrowRight (or Enter / Space) opens the submenu and focuses the first enabled item; inside MenuSubContent, ArrowLeft closes the submenu and returns focus to the trigger. Escape dismisses the innermost open submenu.

SSR

Keep selected, disabled, and icon content stable between server and client so focusable menu items hydrate with the same order and labels. MenuSubContent portals to document.body on mount, so it renders client-side only.

Last updated on