Skip to content

WorkspaceRibbon

Official

Workspace ribbon.

Import:

import { WorkspaceRibbon } from 'obsidian';

Signature:

export class WorkspaceRibbon

Constructor

new WorkspaceRibbon(workspace: Workspace, side: string)

Constructor.

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

Properties

PropertyTypeDescription
containerElHTMLElementThe container element of the ribbon.
itemsRibbonItem[]The registered ribbon items.
ribbonItemsElHTMLElement | nullThe element holding the ribbon action buttons, or null on a side without actions.
ribbonSettingElHTMLElement | nullThe element holding the ribbon settings button, or null on a side without settings.
workspaceWorkspaceReference to the workspace.

Methods

MethodReturnsDescription
addRibbonItemButton(id, icon, title, callback)HTMLElementAdds a ribbon item button.
hide()voidHides the ribbon.
load(state)voidRestores the ribbon's hidden-item state.
makeRibbonItemButton(icon, title, callback)HTMLElementCreates a ribbon item button element without registering it.
onChange(save)voidRe-renders the ribbon items, optionally persisting the layout.
onContextMenu(event)voidShows the ribbon's context menu at the pointer.
removeRibbonAction(id)voidRemoves a ribbon action by id.
serialize()RibbonStateSerializes the ribbon's hidden-item state.
setCollapsedState(collapsed)voidSets the collapsed state of the ribbon.
show()voidShows the ribbon.

Links to this page: