Zephora UI

Navigation

ContextMenu

Right-click menu anchored to the pointer position, driven by a declarative array of actions and separators.

Import

import { ContextMenu } from "@zephora/react";

Examples

Basic

Right-click (or long-press) the area to open the menu.

Right-click here

Last action: none

Disabled and danger entries

File.txt — right-click

API

ContextMenu props

PropTypeDefaultDescription
content *ContextMenuEntry[]—Menu entries: actions, nested submenus and separators (see the entry table below).
onSelect(value: string) => void—Called with the picked entry's value.
childrenReactNode—The right-clickable target area.
disabledbooleanfalseDisables opening the menu.
unstyledbooleanfalseHeadless mode — skips Zephora styling.

ContextMenuEntry props

PropTypeDefaultDescription
label *string—Entry label.
valuestring—Reported to onSelect. Optional for entries that only open a submenu.
disabledboolean—Disables the entry.
dangerboolean—Destructive styling.
iconReactNode—Element rendered before the label.
shortcutstring—Keyboard shortcut hint rendered at the end.
itemsContextMenuEntry[]—Nested entries — renders this entry as a submenu (arbitrary depth).
separatortrue—Pass { separator: true } as an entry to render a divider instead.

Keyboard

KeyAction
ArrowDown / ArrowUpMove the active item through enabled entries.
Home / EndJump to the first / last enabled entry.
Enter / SpacePicks the active entry and closes the menu.
ArrowRight / ArrowLeftOpens / closes the focused submenu level.
Escape / TabCloses the menu.