Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • Parameters

    • root: Element
    • Optional foundation: FoundationType
    • Rest ...args: Array<unknown>

    Returns MDCMenu

Properties

Protected foundation_

foundation_: MDCMenuFoundation

Protected root_

root_: Element

Accessors

items

  • get items(): Element[]
  • Return the items within the menu. Note that this only contains the set of elements within the items container that are proper list items, and not supplemental / presentational DOM elements.

    Returns Element[]

open

  • get open(): boolean
  • set open(value: boolean): void

quickOpen

  • set quickOpen(quickOpen: boolean): void

wrapFocus

  • get wrapFocus(): boolean
  • set wrapFocus(value: boolean): void

Methods

destroy

  • destroy(): void

emit

  • emit<T>(evtType: string, evtData: T, shouldBubble?: boolean): void
  • Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.

    Type parameters

    • T: object

    Parameters

    • evtType: string
    • evtData: T
    • Default value shouldBubble: boolean = false

    Returns void

getDefaultFoundation

getOptionByIndex

  • getOptionByIndex(index: number): Element | null
  • Parameters

    • index: number

    Returns Element | null

    The item within the menu at the index specified.

hoistMenuToBody

  • hoistMenuToBody(): void

initialSyncWithDOM

  • initialSyncWithDOM(): void

initialize

listen

  • Wrapper method to add an event listener to the component's root element. This is most useful when listening for custom events.

    Type parameters

    Parameters

    Returns void

  • Type parameters

    • E: Event

    Parameters

    Returns void

setAbsolutePosition

  • setAbsolutePosition(x: number, y: number): void

setAnchorCorner

  • setAnchorCorner(corner: Corner): void
  • Parameters

    • corner: Corner

      Default anchor corner alignment of top-left menu corner.

    Returns void

setAnchorElement

  • setAnchorElement(element: Element): void
  • Sets the element that the menu-surface is anchored to.

    Parameters

    • element: Element

    Returns void

setAnchorMargin

  • setAnchorMargin(margin: Partial<MDCMenuDistance>): void

setDefaultFocusState

  • setDefaultFocusState(focusState: DefaultFocusState): void
  • Sets default focus state where the menu should focus every time when menu is opened. Focuses the list root (DefaultFocusState.LIST_ROOT) element by default.

    Parameters

    • focusState: DefaultFocusState

      Default focus state.

    Returns void

setFixedPosition

  • setFixedPosition(isFixed: boolean): void

setIsHoisted

  • setIsHoisted(isHoisted: boolean): void

unlisten

  • Wrapper method to remove an event listener to the component's root element. This is most useful when unlistening for custom events.

    Type parameters

    Parameters

    Returns void

  • Type parameters

    • E: Event

    Parameters

    Returns void

Static attachTo

Generated using TypeDoc