Pen Settings



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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


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


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.


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.


                <!-- Bootstrap core CSS -->
<link href="" rel="stylesheet">
<!-- Font Awesome -->
<script src=""></script>

<div class="container">
  <div class="row">
    <div class="col-sm-3 p-r-0" style="min-width: 200px;">
      <div id="colorpalette" class="colorpalette"></div>
      Size: <input id="size" type="range" min="0.5" max="100" value="1" step="0.1"/>
        <span id="eraser" class="btn btn-secondary eraser center-block"><i class="fa fa-eraser" aria-hidden="true"></i></span>
    <div class="col-sm-9 p-l-0 p-r-0">
      <!-- SketchpadJS container here: -->
      <div id="sketchpad"></div>

<!-- - free online drawing board tool -->
<script src=""></script>



                #sketchpad {
    right: 0;
    width: 100%;
    height: 640px;
    border:1px solid rgba(128, 128, 128, 1);



                /*global window, Sketchpad, Colorpalette*/

function initSketchpad() {
    "use strict";
    //create sketchpad on #sketchpad element
    var sketchpad = new Sketchpad({
        containerEl: document.getElementById("sketchpad"),
        createPageConfig: {no: 1}
    // avaliable tools `src/sketchpad.tool.*.js`, ex. "pen", "colouring", "line", "rect", "circ"...
    var toolId = "pen";
    var tool = sketchpad.setTool(toolId).getCurrentTool();

    //create colorpalette on #colorpalette element
    var colorpalette = new Colorpalette({
        containerEl: document.getElementById("colorpalette")
    }).on("change", function (e) { //bind on change event
        sketchpad.setTool(toolId).getCurrentTool().setColor(,,, e.color.alpha);
    }).setColor(tool.setColor(128, 64, 32, 1).getColor()); //set default color

    // bind on change size event
    document.getElementById("size").addEventListener("change", function (e) {
    document.getElementById("size").value = tool.setSize(2).getSize();//set default size

    // bind eraser button
    document.getElementById('eraser').addEventListener("click", function () {

    //make objects below visible in global scope
    window.sketchpad = sketchpad;
    window.colorpalette = colorpalette;
    window.tool = tool;