Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://gojs.net/latest/release/go.js"></script>


<body>

  <div id="myDiagramDiv" style="width:300px; height:300px"></div> 
  <button id="button">button</button>
  <p><a href="https://gojs.net"/>gojs. net<a/></p>
</body>
              
            
!

CSS

              
                
              
            
!

JS

              
                function init() {

  myDiagram = new go.Diagram("myDiagramDiv",  // create a Diagram for the DIV HTML element
    {
      "undoManager.isEnabled": true  // enable undo & redo
    });

  // define a simple Node template
  myDiagram.nodeTemplate =
    new go.Node("Auto")  // the Shape will go around the TextBlock
      .add(new go.Shape("RoundedRectangle", { strokeWidth: 0, fill: "white" })
        // Shape.fill is bound to Node.data.color
        .bind("fill", "color"))
      .add(new go.TextBlock(
        { margin: 8, font: "bold 14px sans-serif", stroke: '#333' }) // Specify a margin to add some room around the text
        // TextBlock.text is bound to Node.data.key
        .bind("text", "key"));

  // but use the default Link template, by not setting Diagram.linkTemplate

  // create the model data that will be represented by Nodes and Links
  myDiagram.model = new go.GraphLinksModel(
    [
      { key: "Alpha", color: "lightblue" },
      { key: "Beta", color: "orange" },
      { key: "Gamma", color: "lightgreen" },
      { key: "Delta", color: "pink" }
    ],
    [
      { from: "Alpha", to: "Beta" },
      { from: "Alpha", to: "Gamma" },
      { from: "Beta", to: "Beta" },
      { from: "Gamma", to: "Delta" },
      { from: "Delta", to: "Alpha" }
    ]);

  document.getElementById('button').addEventListener('click', function() {
    // do something on button click
  })

} // end init


init();



              
            
!
999px

Console