Is it possible to add custom icons along with labels for the context menu as shown
yes we can, You have action registry for that and use proper icon
@LOGAN thank you for the discussion, it is possible to add an icon
to a menu item, or an iconClass
to the command itself. We have a few examples, most notably from the debug
main-menu, but it also works for context-menus:
Example:
export const UPLOAD = Command.toLocalizedCommand({
id: 'file.upload',
category: CommonCommands.FILE_CATEGORY,
- label: 'Upload Files...'
+ label: 'Upload Files...',
+ iconClass: codicon('cloud-upload')
}, 'theia/filesystem/uploadFiles', CommonCommands.FILE_CATEGORY_KEY);
Please note that if you are running the desktop (electron) application the icons will not be visible unless you have the preference which enables the custom menus over native ones on (this is also not true for all operating systems).
Thank you
It worked