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.


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.


                <base href="">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="app-toast.html">
  <style is="custom-style">
    app-toast.styled {
      --app-toast: {
        color: red;
        background-color: #888;
      --app-toast-button: {
        color: blue;
      --app-toast-main-icon: {
        color: green;
      --app-toast-main-icon-stroke-color: orange;
      --app-toast-cancel-icon: {
        color: purple;

<app-toast id="toast"></app-toast>
<select id="icon">
  <option>No icon</option>
  <option selected>check-circle</option>
Text: <input id="text" placeholder="text" value="text"/><br/>
Duration: <input id="duration" placeholder="duration (ms)" value="3000"/><br/>
Action Text: <input id="actionText" placeholder="action button text" value="action"/><br/>
<label><input id="showCancel" type="checkbox"/>Show cancel</label><br/>
<label><input id="disableSwipe" type="checkbox"/>Disable swipe</label><br/>
<label><input id="fitBottom" type="checkbox"/>Fit to bottom</label><br/>
<label><input id="styled" type="checkbox"/>Styled</label><br/>
<button onclick="showToast()">Show</button>&nbsp;
<button onclick="toast.close()">Close</button><br/>
Last Event: <span id="feedback"></span>
  var toast = document.getElementById('toast');
  var icon = document.getElementById('icon');
  var text = document.getElementById('text');
  var duration = document.getElementById('duration');
  var actionText = document.getElementById('actionText');
  var showCancel = document.getElementById('showCancel');
  var disableSwipe = document.getElementById('disableSwipe');
  var fitBottom = document.getElementById('fitBottom');
  var styled = document.getElementById('styled');
  var feedback = document.getElementById('feedback');
  function showToast() {
    var tmp = icon.options[icon.selectedIndex].text;
    toast.icon = tmp == 'No icon' ? '' : tmp;
    toast.text = text.value;
    toast.duration = Number(duration.value);
    toast.actionText = actionText.value;
    toast.showCancel = showCancel.checked;
    toast.disableSwipe = disableSwipe.checked;
    toast.fitBottom = fitBottom.checked;
    toast.onAction = function() { feedback.innerText = "onAction()"; };
    toast.onCancel = function() { feedback.innerText = "onCancel()"; };
    if (styled.checked) toast.classList.add('styled');
    else toast.classList.remove('styled');;