Skip to content

Function: useToolbar() ​

ts
function useToolbar(editor, options): UseToolbarResult;

Accessible toolbar behaviour. Options are read once, like useEditor().

Parameters ​

ParameterType
editorEditor
optionsToolbarOptions

Returns ​

UseToolbarResult

Example ​

tsx
const toolbar = useToolbar(editor, { items: basicToolbarItems() })
<div {...toolbar.getRootProps()}>
  {toolbar.items.map((item) => <button key={item.id} {...toolbar.getItemProps(item.id)}>…</button>)}
</div>