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

Property Type Description
_ Record<string, EventsEntry[]> Internal storage of registered event handlers by event name.
(Inherited from WorkspaceParent)
allowSingleChild boolean Whether this parent is allowed to contain a single child (rather than collapsing it).
(Inherited from WorkspaceParent)
app App Reference to the app instance.
(Inherited from WorkspaceParent)
autoManageDOM boolean Whether this parent automatically manages the DOM of its children.
(Inherited from WorkspaceParent)
children WorkspaceItem[] The child items contained in this parent.
(Inherited from WorkspaceParent)
component Component The component managing the lifecycle of this workspace item.
(Inherited from WorkspaceParent)
containerEl HTMLDivElement Container element for this workspace item.
(Inherited from WorkspaceParent)
currentTab number The index of the currently selected tab.
dimension null | number The flex-grow dimension of this item within its parent split.
(Inherited from WorkspaceParent)
hasLockedTabWidths boolean Whether the tab widths are currently locked (e.g. during a drag).
id string Unique identifier for this workspace item.
(Inherited from WorkspaceParent)
isStacked boolean Whether the tabs are displayed in stacked mode.
parent WorkspaceSplit The parent of the tabs.
resizeHandleEl HTMLHRElement The resize handle element used for adjusting item dimensions.
(Inherited from WorkspaceParent)
tabHeaderContainerEl HTMLElement The container element for the tab headers.
tabHeaderEls HTMLElement[] The individual tab header elements.
tabsContainerEl HTMLElement The container element for the tab contents.
tabsInnerEl HTMLElement The inner container element for the tab headers.
type string The type identifier for this workspace item (e.g. 'leaf', 'split', 'tabs').
(Inherited from WorkspaceParent)
workspace Workspace Reference to the workspace this item belongs to.
(Inherited from WorkspaceParent)

Methods

Method Returns Description
detach() void Detach this item from its parent.
(Inherited from WorkspaceParent)
getContainer() WorkspaceContainer Get the root container parent item, which can be one of:. - WorkspaceRoot - WorkspaceWindow
(Inherited from WorkspaceParent)
getIcon() IconName Get the icon name for this workspace item.
(Inherited from WorkspaceParent)
getRoot() WorkspaceItem Get the root item.
(Inherited from WorkspaceParent)
getTabInsertLocation(x) TabInsertLocation Computes where a dragged tab would be inserted for a given horizontal position.
insertChild(index, child) void Inserts a child at the given index.
(Inherited from WorkspaceParent)
lockTabWidths() void Locks the current tab widths so they do not reflow during a drag.
off(name, callback) void Remove an event listener.
(Inherited from WorkspaceParent)
offref(ref) void Remove an event listener by reference.
(Inherited from WorkspaceParent)
on(name, callback, ctx?) EventRef Add an event listener.
(Inherited from WorkspaceParent)
onContainerScroll() void Handles scrolling of the tab container in stacked mode.
onResizeStart(evt) void Handle the start of a resize operation on this item.
(Inherited from WorkspaceParent)
recomputeChildrenDimensions() void Recomputes the dimensions of the children.
(Inherited from WorkspaceParent)
removeChild(child) void Removes a child.
(Inherited from WorkspaceParent)
replaceChild(index, child) void Replaces the child at the given index.
(Inherited from WorkspaceParent)
scrollIntoView(index) void Scrolls the tab at the given index into view.
selectTab(tab) void Selects the given tab.
selectTabIndex(index) void Selects the tab at the given index.
serialize() SerializedWorkspaceItem Serialize this workspace item's state for persistence.
(Inherited from WorkspaceParent)
setDimension(dimension) void Set the flex-grow dimension of this item within its parent split.
(Inherited from WorkspaceParent)
setParent(parent) void Set the parent split for this workspace item.
(Inherited from WorkspaceParent)
setStacked(stacked) void Enables or disables stacked tab display.
trigger(name, data?) void Trigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from WorkspaceParent)
tryTrigger(evt, args) void Try to trigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from WorkspaceParent)
unlockTabWidths() void Unlocks previously locked tab widths.
updateSlidingTabs() void Updates the sliding-tab layout in stacked mode.
updateTabDisplay() void Updates the displayed tab, showing the current one and hiding the rest.

Links to this page: