Function: useToolbar()
ts
function useToolbar(editor, options): UseToolbarResult;Accessible toolbar behaviour. Options are read once, like useEditor().
Parameters
| Parameter | Type |
|---|---|
editor | Editor |
options | ToolbarOptions |
Returns
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>