Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface BaseDropdownMenuProps

Hierarchy

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 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.

Optional defaultVisible

defaultVisible: boolean

Boolean if the menu should be visible immediately once this component mounts.

Optional horizontal

horizontal: boolean

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

id

id: string

The id to use for the menu button and used to create the id for the menu. The menu's id will just be ${id}-menu.

Optional itemRenderer

itemRenderer: (item: ValidMenuItem, key: string) => ReactNode

Type declaration

    • A function to call for each item in the items list to render a ReactElement.

      Parameters

      Returns ReactNode

items

items: readonly ValidMenuItem[]

A list of menu items to render. Each item will be passed to the menuItemRenderer function.

Optional menuClassName

menuClassName: string

An optional className to pass to the menuRenderer/Menu component.

Optional menuLabel

menuLabel: string

The label to use for the menu. Either this or the menuLabelledBy props are required for a11y.

Optional menuLabelledBy

menuLabelledBy: string

The id for an element to label the menu. Either this or the menuLabel props are required for a11y. This will be defaulted to the id of the menu button for convenience since it should normally label the menu but should be changed if it does not.

Optional menuRenderer

menuRenderer: MenuRenderer

A custom menu renderer to use. This defaults to just rendering the Menu component with the base required props and a generated id from the button id.

Optional menuStyle

menuStyle: CSSProperties

An optional style object to pass to the menuRenderer/Menu component.

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.

Methods

Optional onVisibilityChange

  • onVisibilityChange(visible: boolean): void

Generated using TypeDoc