Skip to content

Interface: Toolbar ​

Controller returned by createToolbar().

Properties ​

PropertyModifierTypeDescription
itemsreadonlyreadonly ToolbarItem[]The items passed in options.

Methods ​

getCustomItemProps() ​

ts
getCustomItemProps(id, props): ElementProps;

Make an element that is not one of items (for example the link popover's trigger) part of the toolbar's keyboard navigation. Its own props are kept; the toolbar adds the roving tabindex and focus tracking.

Parameters ​

ParameterType
idstring
propsElementProps

Returns ​

ElementProps


getItemProps() ​

ts
getItemProps(id): ElementProps;

Props for an item's button: aria-label, title with the shortcut, aria-keyshortcuts, aria-pressed and data-state for toggles, disabled, roving tabindex. Click runs the command without taking focus from the editor. Throws for an unknown id.

Parameters ​

ParameterType
idstring

Returns ​

ElementProps


getRootProps() ​

ts
getRootProps(): ElementProps;

Props for the toolbar element: role, aria-label, aria-orientation. Arrow keys, Home and End move focus between enabled items.

Returns ​

ElementProps


getState() ​

ts
getState(): ToolbarState;

The current state; the same object until something changes.

Returns ​

ToolbarState


subscribe() ​

ts
subscribe(listener): () => void;

Listen for state changes. The toolbar follows the editor only while someone listens.

Parameters ​

ParameterType
listener() => void

Returns ​

() => void