Skip to main content
Version: Next

ContextMenu API

import { ContextMenu } from '@editora/ui-react';

Props​

PropTypeDescription
anchorElHTMLElement | null
anchorIdstring
anchorPoint{ x: number; y: number }
closeOnEscapeboolean
closeOnSelectboolean
density'default' | 'compact' | 'comfortable'
disabledboolean
elevation'default' | 'none' | 'low' | 'high'
itemsMenuItem[]
onChange(open: boolean) => void
onClose() => void
onCloseDetail(detail: { open: boolean; previousOpen: boolean; source: string }) => void
onOpen() => void
onOpenDetail(detail: { open: boolean; previousOpen: boolean; source: string }) => void
onSelect(detail: { index: number; value?: string; label?: string; checked?: boolean; item?: HTMLElement }) => void
openboolean
radiusnumber | string | 'none' | 'sm' | 'md' | 'lg' | 'full'
shape'default' | 'square' | 'soft'
size'sm' | 'md' | 'lg' | '1' | '2' | '3'
state'idle' | 'loading' | 'error' | 'success'
stateTextstring
tone'default' | 'brand' | 'neutral' | 'info' | 'danger' | 'success' | 'warning'
typeaheadboolean
variant'default' | 'surface' | 'soft' | 'solid' | 'outline' | 'contrast' | 'flat'

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Element: <ui-context-menu>​

ContextMenu renders the ui-context-menu custom element from @editora/ui-core, which can also be used without React.

Attributes: close-on-escape, close-on-select, density, disabled, elevation, headless, open, placement, radius, shape, size, state, state-text, tone, typeahead, variant

Events: change, select