Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ProvidedContextMenuProps

Hierarchy

  • Required<Pick<MenuProps, ProvidedPropNames>>
    • ProvidedContextMenuProps

Index

Properties

anchor

anchor: PositionAnchor

The positioning anchor for the menu relative to the button/control that owns the menu. This is used for the positioning logic as well as modifying the animationg slightly to originate from a coordinate. When this is omitted, it will default to:

const verticalAnchor = {
  x: "inner-right",
  y: "top",
};

const horizontalAnchor = {
  x: "center",
  y: "center",
};

classNames

classNames: string | CSSTransitionClassNames

The animation classNames applied to the component as it enters or exits. A single name can be provided and it will be suffixed for each stage: e.g.

classNames="fade" applies fade-enter, fade-enter-active, fade-exit, fade-exit-active, fade-appear, and fade-appear-active.

Each individual classNames can also be specified independently like:

classNames={{
  appear: 'my-appear',
  appearActive: 'my-appear-active',
  appearDone: 'my-appear-done',
  enter: 'my-enter',
  enterActive: 'my-enter-active',
  enterDone: 'my-enter-done',
  exit: 'my-exit',
  exitActive: 'my-exit-active',
  exitDone: 'my-exit-done'
}}

disableControlClickOkay

disableControlClickOkay: boolean

Boolean if the close on outside click logic should consider the control element within the menu and not call the onRequestClose function when it is been clicked. This should be enabled when creating a context menu but normally should remain false otherwise since the control element has it's own toggle logic that conflicts with this close click.

id

id: string

The id for the menu. This is required for a11y.

positionOptions

positionOptions: MenuPositionOptions

Optional options to pass down to the useFixedPositionin hook styles to change how the menu is fixed to the MenuButton.

visible

visible: boolean

Boolean if the menu is currently visible.

Methods

onRequestClose

  • onRequestClose(): void
  • A function to call that should set the visible prop to false.

    Returns void

ref

  • ref(instance: null | HTMLDivElement): void
  • A ref that must be provided to the Menu component that is acting as a context menu if you want to allow the native context menus within this custom context menu.

    If this is never provided to the Menu component, right clicking (to inspect an element for example) will close this context menu.

    Parameters

    • instance: null | HTMLDivElement

    Returns void

Generated using TypeDoc