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

Property Type Description
containerEl HTMLElement The container element of the ribbon.
items RibbonItem[] The registered ribbon items.
ribbonItemsEl HTMLElement | null The element holding the ribbon action buttons, or null on a side without actions.
ribbonSettingEl HTMLElement | null The element holding the ribbon settings button, or null on a side without settings.
workspace Workspace Reference to the workspace.

Methods

Method Returns Description
addRibbonItemButton(id, icon, title, callback) HTMLElement Adds a ribbon item button.
hide() void Hides the ribbon.
load(state) void Restores the ribbon's hidden-item state.
makeRibbonItemButton(icon, title, callback) HTMLElement Creates a ribbon item button element without registering it.
onChange(save) void Re-renders the ribbon items, optionally persisting the layout.
onContextMenu(event) void Shows the ribbon's context menu at the pointer.
removeRibbonAction(id) void Removes a ribbon action by id.
serialize() RibbonState Serializes the ribbon's hidden-item state.
setCollapsedState(collapsed) void Sets the collapsed state of the ribbon.
show() void Shows the ribbon.

Links to this page: