Skip to content

Add tooltips for custom commands to List Items’ context menu #2018

@OlhaY

Description

@OlhaY

Hello,
we are using SharePoint Framework Extensions: Command Set to add custom commands to contextual menu and toolbar.

There are no issue to add commands whereas we faced an issue how to add tooltips to custom commands.

1. our .manifest.json file content looks like that:

 {
      "$schema": "https://dev.office.com/json-schemas/spfx/command-set-extension-manifest.schema.json",
      "id": "...",
      "alias": "DocumentLibraryCommandSet",
      "componentType": "Extension",
      "extensionType": "ListViewCommandSet",
      "requiresCustomScript": false,
      "items": {
        "SomeId": {
          "title": {
            "default": "some name"
          },
          "iconImageUrl": "...",
          "type": "command"
        },
    }
}

2. we added classs which extends 'BaseListViewCommandSet' and overrided: onInit, onListViewUpdated, onExecute.

export default class xxxtLibraryCommandSet extends BaseListViewCommandSet<xxx> {

    @override
    public onInit(): Promise<void> {
        return xxx;
    }

    @override
    public onListViewUpdated()
       xxx
    }

    @override
    public onExecute(xxx): void {
       xxx
    }

3. classes

  • 'BaseListViewCommandSet' extends 'BaseExtension', there is 'context:
    ListViewCommandSetContext'
  • 'ListViewCommandSetContext' has 'manifest:ICommandSetExtensionManifest'
  • here are 'items' with 'ICommandDefinition' type
    items: { [itemId: string]: ICommandDefinition; };

and 'ICommandDefinition' has only 4 fields

(I'm not able to add, for example desctiption or tooltip here)

export interface ICommandDefinition {
    title: ILocalizedString;
    type: 'command';
    ariaLabel?: ILocalizedString;
    iconImageUrl?: string;
}

Could anybody to give a hint how to add tooltips to custom commands?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:spfxCategory: SharePoint Framework (not extensions related)type:questionQuestion... if answered, will be tagged as such.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions