Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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.


                <div class="container">
  <div style="font-weight: bold">Drag slider to control progress:</div>
  <input type="range" min="0" max="1" step=".001" defaultValue=".5" id="range"></input>
  <div id="indicator"></div>
  <div id="mount-6e8b0a8d-7696-4a98-931f-22907a85784d"></div>


                .container {
  background-color: rgb(236,236,236);
  text-align: center;
  width: 365px;
  overflow: hidden;


The script injection/onload dance here is to fix a race condition with the component.
Scripts were being loaded out of order causing required variables to be undefined.
Various "domready" hooks did not do the trick, as they either wouldn't fire in some
cases, or would fire but before all the inlined scripts had been loaded.
var s1 = document.createElement('script')
s1.onload = function () {
  var s2 = document.createElement('script')
  s2.onload = function () {
    window.component = HaikuComponentEmbed_Matthew_Tutorial1(document.getElementById('mount-6e8b0a8d-7696-4a98-931f-22907a85784d'))
    window.component.assignConfig({options: {loop: true, overflowY: 'visible', overflow: 'visible'}, states: {uploadProgress: {value: 0}}})
    var range = document.querySelector("#range")
    var indicator = document.querySelector("#indicator")
    var override = false
    window.handleRangeChange = function(evt){
      var newProgress = parseFloat(range.value)
      indicator.innerHTML = newProgress
      override = true
      window.component.assignConfig({states: {uploadProgress: {value: newProgress}}})
    range.addEventListener("change", window.handleRangeChange)
    range.addEventListener("input", window.handleRangeChange)
    var progress = 0
    function updateProgress() {
        if(progress >= 1.5){
          progress = 0
        }else if(Math.random() < .3){
          progress += Math.random() * .03
        var apparentProgress = Math.round(Math.min(1, progress) * 1000) / 1000
        indicator.innerHTML = apparentProgress
        window.component.assignConfig({states: {uploadProgress: {value: apparentProgress}}})
    if (window.__tut1interval !== undefined) {
    window.__tut1interval = setInterval(updateProgress, 32)
  s2.setAttribute('src', '')
s1.setAttribute('src', '')