Skip to content

PluginSuggestionComponentConstructorParams

Parameters for the PluginSuggestionComponent constructor.

Import:

import type { PluginSuggestionComponentConstructorParams } from 'obsidian-dev-utils/obsidian/components/plugin-suggestion-component';

Signature:

export interface PluginSuggestionComponentConstructorParams

Properties

PropertyTypeDescription
appAppThe Obsidian app instance.
pluginNoticeComponentPluginNoticeComponentThe notice component of the plugin making the suggestion, used to show the suggestion and its outcome.
pluginSettingsComponentPluginSettingsComponentBase<object>The settings component holding whatever isSuggestionDeclined reads.

Taken as a whole component rather than as a bare "ready" flag so the host cannot forget to wire the wait: the notice is decided only after this component has read data.json. See PluginSettingsComponentBase.whenLoadedFromFile for why the read cannot simply happen at layout-ready.
reasonstringThe localized sentence explaining what the host plugin cannot do without the suggested plugin. The host plugin owns this string: only it knows which of its features are affected.
suggestedPluginIdstringThe id of the suggested plugin, as listed in Obsidian's community plugin registry.
suggestedPluginNamestringThe display name of the suggested plugin, shown to the user.

Methods

MethodReturnsDescription
isSuggestionDeclined(this)booleanWhether the user has already declined this suggestion.

Storage belongs to the host plugin (typically one of its settings), because this component has no data.json of its own and a decline has to outlive a reload.

Only ever called once pluginSettingsComponent reports its settings loaded, so an implementation reading a setting is guaranteed to read the stored value rather than its default.
setSuggestionDeclined(this, isDeclined)Promisable<void>Records the user's answer to the suggestion.