Skip to content

WorkspaceTabs

Official

Workspace tabs.

Import:

import { WorkspaceTabs } from 'obsidian';

Signature:

export class WorkspaceTabs extends WorkspaceParent

Extends: WorkspaceParent

Constructor

new WorkspaceTabs(workspace: Workspace, id?: string | undefined)

Constructor.

To get the constructor instance, use getWorkspaceTabsConstructor from obsidian-typings/implementations.

Properties

PropertyTypeDescription
_Record<string, EventsEntry[]>Internal storage of registered event handlers by event name.
(Inherited from WorkspaceParent)
allowSingleChildbooleanWhether this parent is allowed to contain a single child (rather than collapsing it).
(Inherited from WorkspaceParent)
appAppReference to the app instance.
(Inherited from WorkspaceParent)
autoManageDOMbooleanWhether this parent automatically manages the DOM of its children.
(Inherited from WorkspaceParent)
childrenWorkspaceItem[]The child items contained in this parent.
(Inherited from WorkspaceParent)
componentComponentThe component managing the lifecycle of this workspace item.
(Inherited from WorkspaceParent)
containerElHTMLDivElementContainer element for this workspace item.
(Inherited from WorkspaceParent)
currentTabnumberThe index of the currently selected tab.
dimensionnull | numberThe flex-grow dimension of this item within its parent split.
(Inherited from WorkspaceParent)
hasLockedTabWidthsbooleanWhether the tab widths are currently locked (e.g. during a drag).
idstringUnique identifier for this workspace item.
(Inherited from WorkspaceParent)
isStackedbooleanWhether the tabs are displayed in stacked mode.
parentWorkspaceSplitThe parent of the tabs.
resizeHandleElHTMLHRElementThe resize handle element used for adjusting item dimensions.
(Inherited from WorkspaceParent)
tabHeaderContainerElHTMLElementThe container element for the tab headers.
tabHeaderElsHTMLElement[]The individual tab header elements.
tabsContainerElHTMLElementThe container element for the tab contents.
tabsInnerElHTMLElementThe inner container element for the tab headers.
typestringThe type identifier for this workspace item (e.g. 'leaf', 'split', 'tabs').
(Inherited from WorkspaceParent)
workspaceWorkspaceReference to the workspace this item belongs to.
(Inherited from WorkspaceParent)

Methods

MethodReturnsDescription
detach()voidDetach this item from its parent.
(Inherited from WorkspaceParent)
getContainer()WorkspaceContainerGet the root container parent item, which can be one of:. - WorkspaceRoot - WorkspaceWindow
(Inherited from WorkspaceParent)
getIcon()IconNameGet the icon name for this workspace item.
(Inherited from WorkspaceParent)
getRoot()WorkspaceItemGet the root item.
(Inherited from WorkspaceParent)
getTabInsertLocation(x)TabInsertLocationComputes where a dragged tab would be inserted for a given horizontal position.
insertChild(index, child)voidInserts a child at the given index.
(Inherited from WorkspaceParent)
lockTabWidths()voidLocks the current tab widths so they do not reflow during a drag.
off(name, callback)voidRemove an event listener.
(Inherited from WorkspaceParent)
offref(ref)voidRemove an event listener by reference.
(Inherited from WorkspaceParent)
on(name, callback, ctx?)EventRefAdd an event listener.
(Inherited from WorkspaceParent)
onContainerScroll()voidHandles scrolling of the tab container in stacked mode.
onResizeStart(evt)voidHandle the start of a resize operation on this item.
(Inherited from WorkspaceParent)
recomputeChildrenDimensions()voidRecomputes the dimensions of the children.
(Inherited from WorkspaceParent)
removeChild(child)voidRemoves a child.
(Inherited from WorkspaceParent)
replaceChild(index, child)voidReplaces the child at the given index.
(Inherited from WorkspaceParent)
scrollIntoView(index)voidScrolls the tab at the given index into view.
selectTab(tab)voidSelects the given tab.
selectTabIndex(index)voidSelects the tab at the given index.
serialize()SerializedWorkspaceItemSerialize this workspace item's state for persistence.
(Inherited from WorkspaceParent)
setDimension(dimension)voidSet the flex-grow dimension of this item within its parent split.
(Inherited from WorkspaceParent)
setParent(parent)voidSet the parent split for this workspace item.
(Inherited from WorkspaceParent)
setStacked(stacked)voidEnables or disables stacked tab display.
trigger(name, data?)voidTrigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from WorkspaceParent)
tryTrigger(evt, args)voidTry to trigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from WorkspaceParent)
unlockTabWidths()voidUnlocks previously locked tab widths.
updateSlidingTabs()voidUpdates the sliding-tab layout in stacked mode.
updateTabDisplay()voidUpdates the displayed tab, showing the current one and hiding the rest.

Links to this page: