flexlayout-react
    Preparing search index...

    Interface IPopupMenuProps

    Props for the reusable PopupMenu control and the showPopupMenu helper. The control has no dependency on the layout model - it can be used as a standalone menu/context menu.

    interface IPopupMenuProps {
        anchor: DOMRect | HTMLElement | { x: number; y: number };
        classNameMapper?: (defaultClassName: string) => string;
        container?: HTMLElement;
        items: PopupMenuEntry[];
        onClose: () => void;
        onSelect?: (item: IPopupMenuItem) => void;
        renderItem?: (
            item: IPopupMenuItem,
            index: number,
            api: IPopupMenuItemApi,
        ) => ReactNode;
        returnFocusTo?: HTMLElement;
        title?: string;
    }
    Index
    anchor: DOMRect | HTMLElement | { x: number; y: number }

    where to position the menu: a screen point (e.g. a right-click location), a DOMRect, or an element to anchor to. An element is measured when the menu opens.

    classNameMapper?: (defaultClassName: string) => string

    maps default class names to custom ones (e.g. for css modules); defaults to identity

    container?: HTMLElement

    element the menu is positioned within and portalled into; defaults to the anchor's document body. Should be a positioned element (e.g. the FlexLayout root) for precise placement.

    the menu entries (selectable items and/or dividers)

    onClose: () => void

    called when the menu closes (selection, Escape/Tab, outside click, or programmatic hide)

    onSelect?: (item: IPopupMenuItem) => void

    called with the chosen item when one is selected

    renderItem?: (
        item: IPopupMenuItem,
        index: number,
        api: IPopupMenuItemApi,
    ) => ReactNode

    custom renderer for an item; must render an element with role="menuitem" and tabIndex=-1

    returnFocusTo?: HTMLElement

    element to return focus to when the menu closes; defaults to the anchor when it is an element

    title?: string

    accessible label for the menu