Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface AllInjectedMenuProps

Hierarchy

  • MenuPositionProps
  • RequiredMenuProps
  • RenderConditionalPortalProps
    • AllInjectedMenuProps

Index

Properties

Optional 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",
};

Optional aria-label

aria-label: string

Optional aria-labelledby

aria-labelledby: string

children

children: null | boolean | ReactChild | ReactFragment | ReactPortal

Optional className

className: string

Optional closeOnResize

closeOnResize: boolean

Boolean if the menu should no longer close when the page is resized. Instead, it'll automatically update its position within the viewport.

Optional closeOnScroll

closeOnScroll: boolean

Boolean if the menu should not be closed when the page is scrolled. Instead, it'll automatically update its position within the viewport. You normally don't want to enable this prop as the menu won't close if the menu control element is no longer in the viewport.

controlId

controlId: string

The id of the control element that toggles the menu. This is required so that the menu can be positioned to this element and is normally a <button>.

defaultFocus

defaultFocus: string

The element that should be focused first when opened. This can either be the first or last focusable item in the menu, or a query selector string to find an element.

Optional horizontal

horizontal: boolean

Boolean if the menu should be rendered horizontally instead of vertically.

id

id: string

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

Optional onClick

onClick: MouseEventHandler<HTMLDivElement>

Optional onKeyDown

onKeyDown: KeyboardEventHandler<HTMLDivElement>

Optional portal

portal: boolean

Boolean if the portal should be used.

Optional portalInto

portalInto: PortalInto

Optional portalIntoId

portalIntoId: string

Optional positionOptions

positionOptions: MenuPositionOptions

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

Optional style

style: CSSProperties

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

Generated using TypeDoc