adds a new shape to the diagram

void add(object new_item);


new_itemobjectthe object of a new item

Example{ id: "3.2", text: "New Item", parent: "3" });

Related samples


There are two ways to link shapes, you can add a shape with a parent ID defined:{ id: "3.2", text: "New Item", type: "card", parent: "3" });

or you can add a shape and a connector:{ type: "card", id: "3.2", text: "New Item" });{ type: "line",  from: "3", to: "3.2" });

Data properties

  • id - optional, the id of a shape, auto-generated by default
  • type - optional, the type of a shape, "card" by default

The data object can contain any other custom properties. Such custom properties can be retrieved through API or used inside of templates.


The "type" in the above code is the type of a shape or a connector, it can have one of the predefined values:

Shape types for diagram

  • circle
  • document
  • offline
  • etc.

See the full list of types for diagram shapes.

Shape types for Org Chart

  • card
  • img-card

Connector types

  • line
  • dash

Read about connectors configuration options.

See also
Back to top