Skip to content

obsidian plugin open options

NaNdi
Apr 27, 20261 min read

es. Plugin views can open in three places:

1. Main editor area (the center pane):

await this.app.workspace.getLeaf(true).setViewState({
  type: 'my-plugin-view',
  active: true,
});

getLeaf(true) creates a new leaf in the main editor area, not the sidebar. This is how plugins like Canvas, Cards View, and Kanban work -- they take over the center pane.

2. Sidebar (left or right):

await this.app.workspace.getRightLeaf(false).setViewState({
  type: 'my-plugin-view',
  active: true,
});

3. A new window (popout):

await this.app.workspace.openPopoutLeaf().setViewState({
  type: 'my-plugin-view',
  active: true,
});

The key difference is which leaf you target:

| Method | Where | |--------|-------| | getLeaf(true) | Main editor area (new tab) | | getLeaf(false) | Main editor area (replaces current) | | getRightLeaf(false) | Right sidebar | | getLeftLeaf(false) | Left sidebar | | openPopoutLeaf() | Separate window |

So your plugin view doesn't have to be in the sidebar at all. Most "full" plugin views (Canvas, Kanban, Excalidraw) live in the main editor area as a tab alongside markdown files.

Did you enjoy this article?

Recommend it — Standard Reader surfaces well-loved writing to more readers across the network.

Across the AtmosphereDiscussions