Zephora UI

Navigation

Menu

Inline menu list with roving focus — the base of Dropdown and Menubar popups. Items support values, icons, shortcuts, danger styling, grouping, nested submenus and checkbox/radio state.

Import

import { Menu, MenuItem, MenuGroup, MenuSeparator, MenuSub, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem } from "@zephora/react";

Examples

Basic

`onSelect` on the Menu receives the value of any activated item.

Last action: none

Groups, shortcuts and danger

MenuGroup labels related items, MenuSeparator divides sections and `danger` flags destructive actions.

Submenu, checkbox and radio items

MenuSub nests a submenu at arbitrary depth (opens on hover, ArrowRight or Enter). MenuCheckboxItem toggles independent state; MenuRadioItem picks one value inside a MenuRadioGroup.

API

Menu props

PropTypeDefaultDescription
onSelect(value: string) => voidCalled with the item value whenever an item that has a value is activated.
unstyledbooleanfalseHeadless mode — inherited by items.

MenuItem props

PropTypeDefaultDescription
valuestringValue reported to the surrounding Menu onSelect.
disabledbooleanDisables the item.
dangerbooleanDestructive styling.
iconReactNodeElement rendered before the label.
shortcutstringKeyboard shortcut hint rendered at the end.
onSelect(value?: string) => voidCalled when this item is activated (click / Enter / Space).

MenuSub props

PropTypeDefaultDescription
label *ReactNodeLabel of the submenu trigger item.
iconReactNodeElement rendered before the label.
disabledbooleanDisables the trigger.
childrenReactNodeSubmenu content: any Menu item elements — nesting depth is arbitrary.

MenuCheckboxItem props

PropTypeDefaultDescription
checkedbooleanControlled checked state.
defaultCheckedbooleanfalseInitial checked state (uncontrolled).
onCheckedChange(checked: boolean) => voidCalled with the new checked state.
disabledbooleanDisables the item.
iconReactNodeElement rendered before the label.
shortcutstringKeyboard shortcut hint rendered at the end.

MenuRadioGroup props

PropTypeDefaultDescription
valuestringControlled selected value.
defaultValuestringInitial selected value (uncontrolled).
onValueChange(value: string) => voidCalled with the picked item value.
labelReactNodeGroup heading rendered above the items.

MenuRadioItem props

PropTypeDefaultDescription
value *stringValue this radio item represents inside its MenuRadioGroup.
disabledbooleanDisables the item.
iconReactNodeElement rendered before the label.
shortcutstringKeyboard shortcut hint rendered at the end.

MenuGroup props

PropTypeDefaultDescription
labelReactNodeGroup heading rendered above the items.

Keyboard

KeyAction
ArrowDown / ArrowUpMove focus to the next / previous enabled item.
Home / EndFocus the first / last enabled item.
Enter / SpaceActivates the focused item.
ArrowRight / EnterOn a MenuSub trigger: opens the submenu and focuses its first item.
ArrowLeft / EscapeInside a submenu: closes that level and returns focus to its trigger.