Skip to content

ViewState

Official

The state of the view.

Import:

import type { ViewState } from 'obsidian';

Signature:

export interface ViewState

Properties

PropertyTypeDescription
active?booleanWhether the view is active.
group?WorkspaceLeafThe leaf group of the view.
icon?IconNameThe icon of the view, written by WorkspaceLeaf.getViewState as View.getIcon's result, or undefined when that is empty.

Together with ViewState.title it is what lets a leaf restore the view DEFERRED — with both present WorkspaceLeaf.setViewState can show a placeholder carrying them instead of building the real view.
pinned?booleanWhether the view is pinned.
state?Record<string, unknown>The state of the view.
title?stringThe display text of the view, written by WorkspaceLeaf.getViewState as View.getDisplayText's trimmed result, or undefined when that is empty. See ViewState.icon for the deferred-view restore both members feed.
typestringThe type of the view.

Links to this page: