Type Alias TJSContextMenuItemData

TJSContextMenuItemData: {
    class?: Function;
    condition?: boolean | (() => boolean);
    icon?: string;
    image?: string;
    imageAlt?: string;
    label?: string;
    onPress?: ((item: TJSContextMenuItemData, object: any) => void);
    props?: object;
    separator?: "hr";
}

Defines a menu item entry. Depending on the item data that is passed into the menu you can define 4 types of items: 'icon / label', 'image / label', 'class / Svelte component', and 'separator / hr'. A single callback function onPress is supported.

Type declaration

  • Optionalclass?: Function

    A Svelte component class.

  • Optionalcondition?: boolean | (() => boolean)

    If a boolean and false or a function that invoked returns a falsy value this item is not added.

  • Optionalicon?: string

    A string containing icon classes.

  • Optionalimage?: string

    An image icon path.

  • OptionalimageAlt?: string

    An image 'alt' text description.

  • Optionallabel?: string

    A text string that is passed through localization.

  • OptionalonPress?: ((item: TJSContextMenuItemData, object: any) => void)

    A callback function that receives the selected item data and an object containing the A11yFocusSource data that can be passed to any Application / particularly modal dialogs returning focus when closed.

  • Optionalprops?: object

    An object passed on as props for any Svelte component.

  • Optionalseparator?: "hr"

    A menu item separator; only 'hr' supported.