Skip to content

ContextMenuProps

ContextMenuProps are the props of ReactComponent.ContextMenu and RightClickMenu.

type ContextMenuProps = {
menu: React.ReactElement;
children: React.ReactElement | ((isOpen?: boolean, handleContextMenu?: (event: MouseEvent) => void, ref?: (element: Element) => void) => React.ReactElement);
trigger?: 'click' | 'right-click';
action?: 'toggle' | 'open';
placement?: 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
offset?: [number, number];
renderInline?: boolean;
preventScrollingWhileOpen?: boolean;
};
PropDescription
menuThe menu to show, usually a Menu or one of Spotify’s item menus.
childrenThe element that opens the menu, or a function that renders it.
triggerOpens the menu on click or right-click.
actionOpens the menu each time, or toggles it.
placementThe preferred side of the trigger element.
offsetThe horizontal and vertical offset from the trigger element, in pixels.
renderInlineRenders the menu next to children instead of in Spotify’s shared menu in <body>.
preventScrollingWhileOpenStops the page from scrolling while the menu is open.