Pen Settings

HTML

CSS

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

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

Auto Save

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

              
                
<div class="demo-card-wide mdl-card mdl-shadow--4dp">
  <div class="mdl-card__title">
    <div style="width: 100%;">
    <h4>Progress</h4>
    <div id="progress" class="mdl-progress mdl-js-progress"></div>
    </div>
  </div>
  <div class="mdl-card__supporting-text">
    Click buttons to finish tasks and progress.
  </div>
  <div class="mdl-card__actions mdl-card--border">
    <button class="mdl-button mdl-js-button mdl-button--colored mdl-js-ripple-effect" type="button" onclick="foo.set['bt1clicked']()">Task 1</button>
    <button class="mdl-button mdl-js-button mdl-button--colored mdl-js-ripple-effect" type="button" onclick="foo.set['bt2clicked']()">Task 2</button>
    <button class="mdl-button mdl-js-button mdl-button--colored mdl-js-ripple-effect" type="button" onclick="foo.set['bt3clicked']()">Task 3</button>
  </div>
</div>

<div id="toast-snackbar" class="mdl-js-snackbar mdl-snackbar">
  <div class="mdl-snackbar__text"></div>
  <button class="mdl-snackbar__action" type="button"></button>
</div>
              
            
!

CSS

              
                .demo-card-wide {
  margin: 30px auto;
}
              
            
!

JS

              
                // The first argument, the condition array, is simply everything you want on the checklist. Use anything you think best describes the task.
var condition = [
  'bt1clicked',
  'bt2clicked',
  'bt3clicked'
];
// The second argument is the callback function when all the conditions are met. It is called without any arguments.
var executeWhenConditionMet = function () {
  document.getElementById('toast-snackbar').MaterialSnackbar.showSnackbar({message: 'All buttons are clicked!'});
};
// The optional third argument is a callback function when there is a progress update (when another thing gets checked off from the list). It is called with only one argument which is the percentage of total progress ranging from 0 to 1.
var executeWhenProgressUpdate = function (percent) {
  document.getElementById('progress').MaterialProgress.setProgress(percent * 100);
};
// Calling the function SETRACE returns a handle used to check off tasks.
// Use handle.set[conditionName]() to flag one task as completed.
window.foo = SETRACE(condition, executeWhenConditionMet, executeWhenProgressUpdate);
              
            
!
999px

Console