AI Notice: Most documentation right now was auto-generated by an LLM. Handwritten documentation will be implemented over time on the road to 1.0
ContextProviderItem
A single menu item contributed by a context provider. Items are defined statically on the provider and filtered at runtime using canHandle.
Signature
interface ContextProviderItem {
id: string;
label: string;
icon?: string;
danger?: boolean;
render?: import("svelte").Snippet;
canHandle?: (ctx: ContextItemContext) => boolean;
disabled?: boolean | ((ctx: ContextItemContext) => boolean);
shortcut?: ItemShortcutConfig;
action?: (ctx: ContextItemContext) => void | Promise<void>;
}Members
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | Unique item ID within this provider |
label | string | yes | Display label in the menu |
icon | string | no | Icon to display |
danger | boolean | no | Mark as dangerous action (shows in red) |
render | import("svelte").Snippet | no | Custom render snippet instead of standard menu item |
canHandle | (ctx: ContextItemContext) => boolean | no | Per-item visibility check. Used for both menu filtering and shortcut ‘when’ condition. If omitted, item is always visible (when provider matches). |
disabled | boolean | (ctx: ContextItemContext) => boolean | no | Whether the item is disabled. Can be a boolean or a function that receives the context. |
shortcut | ItemShortcutConfig | no | Shortcut configuration. When defined, auto-registers with ShortcutManager using ID: {pluginId}`.`{itemId}. |
action | (ctx: ContextItemContext) => void | Promise<void> | no | Action to execute when the item is clicked or shortcut is triggered. Receives the context with current entry/entries and pane. |