Skip to content

DGMFloatingToolbarHolder

The holder component for a floating toolbar which is shown near selected shapes.

Here is an example how to mount floating toolbar to the editor.

import { Editor } from "@dgmjs/core";
import { DGMEditorCore, DGMFloatingToolbarHolder } from "@dgmjs/react";
function MyFloatingToolbar() {
return <div>my toolbar</div>;
}
function Editor() {
const [editor, setEditor] = useState<Editor | null>(null);
return (
<DGMEditorCore
onMount={(editor) => setEditor(editor)}
>
<DGMFloatingToolbarHolder
editor={editor as Editor}
toolbar={<MyFloatingToolbar/>}
/>
</DGMEditorCore>
}
}

Properties

PropTypeDefault
editorEditor
toolbarReact.ReactNode
distancenumber
onMove(onBelow: boolean) => void