Skip to main content

ElementButton

Namespace for creating HTML buttons

Index

Interfaces

Options

Options:

Various options that can be passed along to ElementButton.Create

optionalclickDisabled

clickDisabled?: (this: HTMLButtonElement, event: MouseEvent) => any

A click event listener to-be fired when a button is disabled via aria-disabled: "true".


Type declaration

    • (this: HTMLButtonElement, event: MouseEvent): any
    • Parameters

      • this: HTMLButtonElement
      • event: MouseEvent

      Returns any

optionaldisabled

disabled?: boolean

Whether the button should be disabled or not

optionalicons

icons?: readonly (InventoryIcon | { iconSrc: string; name: string; tooltipText: string | Node })[]

Button icons to-be displayed in the top-left corner of the button.

Alternatively, one can directly pass the icon's HTMLImageElement.src and its tooltip component.

optionalimage

image?: string

A background image for the button

optionallabel

label?: string

A button label

optionallabelPosition

labelPosition?: top | bottom | center

The position of the button label

optionalnoStyling

noStyling?: boolean

Whether to limit the default styling of the button's border and background

optionalrole

role?: radio | checkbox | menuitemradio | menuitemcheckbox

The role of the button. All accepted values are currently special-cased in order to set role-specific event listeners and/or attributes.

optionaltooltip

tooltip?: string | Node | HTMLOptions<any> | readonly (string | Node | HTMLOptions<any>)[]

Optional tooltip content. If not supplied then one should manually prepend it to the tooltip later

optionaltooltipPosition

tooltipPosition?: top | bottom | left | right

The position of the tooltip w.r.t. the button

Functions

Create

  • Create(id: string, onClick: (this: HTMLButtonElement, ev: MouseEvent | TouchEvent) => any, options?: Options, htmlOptions?: Partial<Record<button | img | label | tooltip, Omit<HTMLOptions<any>, tag>>>): HTMLButtonElement
  • Parameters

    • id: string
    • onClick: (this: HTMLButtonElement, ev: MouseEvent | TouchEvent) => any
      • optionaloptions: Options = null
      • htmlOptions: Partial<Record<button | img | label | tooltip, Omit<HTMLOptions<any>, tag>>> = null

      Returns HTMLButtonElement

    CreateForActivity

    • CreateForActivity(idPrefix: string, activity: ItemActivity, C: Character, onClick: (this: HTMLButtonElement, ev: MouseEvent | TouchEvent) => any, options?: Options, htmlOptions?: Partial<Record<button | img | label | tooltip, Omit<HTMLOptions<any>, tag>>>): HTMLButtonElement
    • Parameters

      • idPrefix: string
      • activity: ItemActivity
      • C: Character
      • onClick: (this: HTMLButtonElement, ev: MouseEvent | TouchEvent) => any
        • optionaloptions: Options = null
        • htmlOptions: Partial<Record<button | img | label | tooltip, Omit<HTMLOptions<any>, tag>>> = null

        Returns HTMLButtonElement

      CreateForAsset

      • CreateForAsset(idPrefix: string, asset: Asset | Item, C: Character, onClick: (this: HTMLButtonElement, ev: MouseEvent | TouchEvent) => any, options?: Options, htmlOptions?: Partial<Record<button | img | label | tooltip, Omit<HTMLOptions<any>, tag>>>): HTMLButtonElement
      • Parameters

        • idPrefix: string
        • asset: Asset | Item
        • C: Character
        • onClick: (this: HTMLButtonElement, ev: MouseEvent | TouchEvent) => any
          • optionaloptions: Options = null
          • htmlOptions: Partial<Record<button | img | label | tooltip, Omit<HTMLOptions<any>, tag>>> = null

          Returns HTMLButtonElement

        ReloadAssetIcons

        _KeyDownRadio

        • _KeyDownRadio(...this: any, ev: KeyboardEvent): void
        • Parameters

          • rest...this: any
          • ev: KeyboardEvent

          Returns void

        _ParseIcons

        • _ParseIcons(id: string, icons?: readonly (InventoryIcon | { iconSrc: string; name: string; tooltipText: string | Node })[]): { iconGrid: HTMLDivElement; tooltip: (string | HTMLElement)[] }
        • Parameters

          • id: string
          • optionalicons: readonly (InventoryIcon | { iconSrc: string; name: string; tooltipText: string | Node })[]

          Returns { iconGrid: HTMLDivElement; tooltip: (string | HTMLElement)[] }

          • iconGrid: HTMLDivElement
          • tooltip: (string | HTMLElement)[]

        _QueryDFS

        • _QueryDFS(root: Element, query: string, filter: (el: Element) => boolean): Generator<Element, void, any>
        • Parameters

          • root: Element
          • query: string
          • filter: (el: Element) => boolean

            Returns Generator<Element, void, any>