Skip to content

Interface: UseToolbarResult ​

Returned by useToolbar().

Properties ​

PropertyModifierTypeDescription
itemsreadonlyreadonly ToolbarItem[]The items passed in options.
statereadonlyToolbarStateThe toolbar state; the component re-renders when it changes.

Methods ​

getCustomItemProps() ​

ts
getCustomItemProps(id, props): ReactProps;

Add your own element (e.g. the link trigger) to the toolbar's arrow-key navigation.

Parameters ​

ParameterType
idstring
propsReactProps

Returns ​

ReactProps


getItemProps() ​

ts
getItemProps(id): ReactProps;

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 ​

ReactProps


getRootProps() ​

ts
getRootProps(): ReactProps;

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

Returns ​

ReactProps