@joint/react
    Preparing search index...

    Function createElements

    • Create elements helper function.

      Type Parameters

      • Element extends GraphElement
      • Type extends undefined | string = "react"

      Parameters

      • items: (Element & ElementWithAttributes<Type>)[]

        Array of elements to create.

      Returns (Element & RequiredElementProps)[]

      Array of elements. (Nodes)

      without custom data

      const elements = createElements([
      { id: '1', type: 'rect', x: 10, y: 10, width: 100, height: 100 },
      { id: '2', type: 'circle', x: 200, y: 200, width: 100, height: 100 },
      ]);

      with custom data

      const elements = createElements([
      { id: '1', type: 'rect', x: 10, y: 10 ,data : { label: 'Node 1' }, width: 100, height: 100 },
      { id: '2', type: 'circle', x: 200, y: 200, data : { label: 'Node 2' }, width: 100, height: 100 },
      ]);