PluginSettingTab
Official
Provides a unified interface for users to configure the plugin.
Import:
import { PluginSettingTab } from 'obsidian';Signature:
export class PluginSettingTab extends SettingTabExtends: SettingTab
Constructor
new PluginSettingTab(app: App, plugin: Plugin)Constructor.
To extract the constructor type, use ExtractConstructor<PluginSettingTab>.
Properties
| Property | Type | Description | |
|---|---|---|---|
| app | App | Reference to the app instance. (Inherited from SettingTab) | |
| containerEl | HTMLElement | HTML element for the setting tab content. (Inherited from SettingTab) | |
| icon | IconName | The icon to display in the settings sidebar. (Inherited from SettingTab) | |
| id | string | Unique ID of the tab. (Inherited from SettingTab) | |
| installedPluginsEl? | HTMLElement | Reference to installed plugins element. Tab is the community plugins tab. (Inherited from SettingTab) | |
| name | string | Sidebar name of the tab. (Inherited from SettingTab) | |
| navEl | HTMLElement | Sidebar navigation element of the tab. (Inherited from SettingTab) | |
| plugin? | Plugin | Reference to the plugin that initialized the tab. Tab is a plugin tab. (Inherited from SettingTab) | |
| renderedItems | unknown[] | The rendered setting items (and groups) currently shown in the tab. (Inherited from SettingTab) | |
| setting | Setting | Reference to the settings modal. (Inherited from SettingTab) | |
| settingItems | SettingDefinitionItem[] | Nested setting definitions as returned by getSettingDefinitions(). Populated by update(). (Inherited from SettingTab) |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| display() | void | Override to render the tab imperatively. Not called when getSettingDefinitions returns a non-empty array; the tab is rendered declaratively from those definitions instead. Only implement display() as a fallback for plugins that need to support Obsidian versions older than 1.13.0.(Inherited from SettingTab) | |
| getControlValue(key) | unknown | Reads from this.plugin.settings. Override to read from a different data source. | |
| getSettingDefinitions() | SettingDefinitionItem[] | ||
| hide() | void | Hides the contents of the setting tab. Any registered components should be unloaded when the view is hidden. Override this if you need to perform additional cleanup. (Inherited from SettingTab) | |
| refreshDomState() | void | Re-evaluate every visible and disabled predicate against the current state and apply the result to the rendered DOM. Call this from a render callback's onChange (or any other imperative path) after mutating state that other settings' predicates depend on.Cheap: toggles CSS state in place, no re-render. For changes that affect the structure of the definitions themselves (added or removed items), call update() instead.(Inherited from SettingTab) | |
| setControlValue(key, value) | void | Promise<void> | Mutates and persists this.plugin.settings. Override to write to a different data source. | |
| update() | void | Stores the result of getSettingDefinitions() for rendering and search indexing. Called by addSettingTab() and by dynamic tabs when their data changes. (Inherited from SettingTab) |