Special/ContextMenu

ContextMenu

Right-click context menu with submenus, keyboard shortcuts display, danger styles, separators, and viewport clamping. Closes on Escape, outside click, or item selection.

import { ContextMenu } from "@animui/ui"

Basic

Right-click in the demo area — the menu appears at cursor position, clamped to the viewport.

Right-click anywhere in this area

Submenus

Pass an items array on any item to create a submenu. The submenu opens on hover with a 150ms delay before closing — smooth enough to reach diagonal positions without it disappearing.

ContextMenuItem props

PropTypeDefaultDescription
idstringUnique identifier.
labelstringDisplay text.
iconReactNodeIcon shown at the left.
shortcutstringKeyboard shortcut shown at the right.
disabledbooleanfalseGrays out the item and prevents selection.
dangerbooleanfalseRenders the item in red.
separatorbooleanfalseRenders a horizontal divider instead of an item.
itemsContextMenuItem[]Nested items — renders a submenu on hover.
onSelect() => voidCalled when the item is clicked.

ContextMenu props

PropTypeDefaultDescription
childrenReactNodeThe element(s) that the context menu is attached to.
itemsContextMenuItem[]Menu items to display.
classNamestringApplied to the children wrapper div.
© 2026 Steal Shadow. MIT License.Report an issue