Phials developer documentation
User guide
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

NameTypeRequiredDescription
idstringyesUnique item ID within this provider
labelstringyesDisplay label in the menu
iconstringnoIcon to display
dangerbooleannoMark as dangerous action (shows in red)
renderimport("svelte").SnippetnoCustom render snippet instead of standard menu item
canHandle(ctx: ContextItemContext) => booleannoPer-item visibility check. Used for both menu filtering and shortcut ‘when’ condition. If omitted, item is always visible (when provider matches).
disabledboolean | (ctx: ContextItemContext) => booleannoWhether the item is disabled. Can be a boolean or a function that receives the context.
shortcutItemShortcutConfignoShortcut configuration. When defined, auto-registers with ShortcutManager using ID: {pluginId}`.`{itemId}.
action(ctx: ContextItemContext) => void | Promise<void>noAction to execute when the item is clicked or shortcut is triggered. Receives the context with current entry/entries and pane.