Skip to content

PluginNoticeComponentShowNoticeOptions

Options for PluginNoticeComponent.showNotice.

Import:

import type { PluginNoticeComponentShowNoticeOptions } from 'obsidian-dev-utils/obsidian/components/plugin-notice-component';

Signature:

export interface PluginNoticeComponentShowNoticeOptions

Properties

PropertyTypeDescription
isPermanent?booleanWhether the notice should stay until it is replaced, the plugin is reloaded, or the user dismisses it.

A permanent notice is shown with an infinite duration and is not hidden when the component unloads, so it can communicate state that outlives the plugin (e.g. a cleanup that requires a reload). There is at most one permanent notice per plugin: it is hidden by the next PluginNoticeComponent.showNotice call and dismissed automatically the next time the component loads (i.e. when the plugin is re-enabled).
isReusable?booleanWhether the notice occupies the single per-plugin reusable slot.

A reusable notice takes the shared slot: the next reusable notice hides it, and it is hidden on unload. A non-reusable (standalone) notice is not placed in the slot — it never hides, and is never hidden by, a reusable notice; multiple standalone notices coexist. Standalone notices are still hidden together on unload.

A permanent notice must be reusable (PluginNoticeComponentShowNoticeOptions.isPermanent implies isReusable); passing isReusable: false together with isPermanent: true throws.
shouldHideOnClick?booleanWhether clicking the notice hides it. When true (the default), the notice dismisses on click like a normal Obsidian notice. When false, the notice is hard to close: it does not dismiss on any stray click, and instead shows a close (X) button that hides it directly (see PluginNoticeComponentShowNoticeOptions.shouldShowCloseButton and PluginNoticeComponentShowNoticeOptions.onCloseClick).

A shouldHideOnClick: false notice is shown with an infinite duration and is standalone (implies PluginNoticeComponentShowNoticeOptions.isReusable = false), so a later notice never silently replaces it; passing isReusable: true together with shouldHideOnClick: false throws.
shouldShowCloseButton?booleanWhether the close (X) button is shown on a hard-to-close notice (PluginNoticeComponentShowNoticeOptions.shouldHideOnClick = false). When false, no close button is rendered and the notice can only be hidden programmatically. Ignored unless shouldHideOnClick is false.

Methods

MethodReturnsDescription
onCloseClick(this, event)Promisable<void>A callback invoked when the user clicks the close (X) button, before the notice is hidden. Call PluginNoticeCloseClickEvent.cancel on the event to cancel the close and keep the notice open — for example after your own confirmation declines. An async callback is awaited before the notice is hidden. Runs only when a close button is shown (both PluginNoticeComponentShowNoticeOptions.shouldHideOnClick = false and PluginNoticeComponentShowNoticeOptions.shouldShowCloseButton are set).
onHide(this, info)Promisable<void>A callback invoked when the notice is hidden — whether by the user closing it, by a later reusable notice replacing it, by its duration elapsing, or on component unload. It runs at most once per notice. The PluginNoticeHideInfo argument distinguishes a user close (the close button) from a programmatic hide. An async callback is run fire-and-forget (its rejection surfaces through the async-error pipeline).