UNPKG

@joint/react

Version:

React bindings and hooks for JointJS to build interactive diagrams and graphs.

18 lines (17 loc) 602 B
import type { dia } from '@joint/core'; import type { GraphElement } from '../types/element-types'; type SetElement<T extends dia.Element | GraphElement> = Omit<Partial<T> & { id: dia.Cell.ID; }, 'isElement' | 'isLink'>; /** * A custom hook that adds an element to the graph. * @group Hooks * @returns A function that adds the element to the graph. * @example * ```ts * const addElement = useCreateElement(); * addElement({ id: '1', label: 'Node 1' }); * ``` */ export declare function useCreateElement<T extends dia.Element | GraphElement>(): (element: SetElement<T>) => void; export {};