Interface CustomHeaderControlsEntry

A custom header control to be placed in the controls menu of an Application V2 window.

const entry = {
icon: 'fas fa-broom',
label: 'Debug Button',
visible(app, document) {
return document.type === 'container';
},
ownership: CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
onClickAction(event, target) {
ui.notifications.info(`Doing cool stuff with ${this.name}.`)
}
}
interface CustomHeaderControlsEntry {
    action?: string;
    icon: string;
    label: string;
    onClickAction?: ((event: PointerEvent, target: HTMLElement) => Promise<void>);
    ownership?: string | number;
    visible?: boolean | ((this: any) => boolean);
}

Properties

action?: string

Optional action name. This name is used when coordinating header control clicks and App V2 action handlers. If no name is provided, a name will be generated.

icon: string

A fontawesome icon class, e.g., "fas fa-broom"

label: string

The header control text to show.

onClickAction?: ((event: PointerEvent, target: HTMLElement) => Promise<void>)

A handler for when this header control is clicked. this is the application instance.

Type declaration

    • (event, target): Promise<void>
    • Parameters

      • event: PointerEvent

        the pointer event that triggered the handler

      • target: HTMLElement

        the header control that was clicked

      Returns Promise<void>

ownership?: string | number

A key or value in CONST.DOCUMENT_OWNERSHIP_LEVELS that restricts visibility of this option for the current user.

visible?: boolean | ((this: any) => boolean)

A boolean or function signifying whether the menu option should be shown. Use the function to conditionally show/hide the menu option on each render. this is the application v2 instance.