Hello world!

In the following few pages of the tutorial, we will understand how to create a basic JointJS diagram:

Feel free to copy-paste the program code into a new file and see it in action for yourself:

<!DOCTYPE html>
    <!-- content -->
    <div id="myholder"></div>

    <!-- dependencies -->
    <script src="https://cdn.jsdelivr.net/npm/@joint/core@4.0.1/dist/joint.js"></script>

    <!-- code -->
    <script type="text/javascript">

        var namespace = joint.shapes;

        var graph = new joint.dia.Graph({}, { cellNamespace: namespace });

        var paper = new joint.dia.Paper({
            el: document.getElementById('myholder'),
            model: graph,
            width: 600,
            height: 100,
            gridSize: 1,
            cellViewNamespace: namespace

        var rect = new joint.shapes.standard.Rectangle();
        rect.position(100, 30);
        rect.resize(100, 40);
            body: {
                fill: 'blue'
            label: {
                text: 'Hello',
                fill: 'white'

        var rect2 = rect.clone();
        rect2.translate(300, 0);
        rect2.attr('label/text', 'World!');

        var link = new joint.shapes.standard.Link();


Even though the code is quite short, it creates a fully interactive JointJS diagram. The program does everything a JointJS application needs to do in order to produce a visual output:

We will look at each of these steps in turn. Use this list as an index of the basic tutorial topics.

First, we need to make sure we have JointJS installed and ready to use.