Skip to main content

Remove panel

A panel can be removed either from its own panel API or from the container API. Removing a panel destroys its instance; the group is removed too once its last panel is gone.

Remove a panel using the Panel API

close
close(): void

Calling close on the panel API is the easiest way to close a panel through code.

panel.api.close();

Remove a panel using the API

removePanel
Remove a panel given the panel object.
removePanel(panel: IDockviewPanel): void

Firstly, you can retrieve a reference to the panel given its id and then you can pass that reference into removePanel to remove the panel.

const panel: IDockviewPanel = api.getPanel('myPanel');
api.removePanel(panel);

See also

  • Adding panels: the counterpart for creating panels.
  • Move panel: relocate a panel instead of destroying it.
  • Panel API: the full set of per-panel methods, including close.