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 id="table" class="shiny-html-output shiny-bound-output"></div>
<button>render shiny simulation</button>



                /* copy from shiny */
.recalculating {
    opacity: 0.3;
    transition: opacity 250ms ease 500ms;
    -moz-transition: opacity 250ms ease 500ms;
    -webkit-transition: opacity 250ms ease 500ms;
    -o-transition: opacity 250ms ease 500ms;


                jQuery(function($) {
// ---------------------------------------------------------------------------
// :: execute callback function when shiny output element is modified
// :: the callback can be called multiple times if you use option onTime: false
// :: you can also use check option with function that will be check if
// :: before executing callback and removing observer
// ::
// :: Copyright (C) Jakub T. Jankiewicz <>
// :: Relased under MIT License
// ---------------------------------------------------------------------------
$.fn.onRender = function(callback, options) {
  var settings = $.extend({
    // if set to true will remove mutation observer after first mutation
    oneTime: true,
    // if set to true will always execute and clear mutation observer on first mutation
    // default will not fire callback when mution is recalcuation of any element
    strict: false,
    name: 'default',
    observer: {childList: true, subtree: true, attributes: true},
    check: function(node) { return node.closest('body').length; }
  }, options || {});
  var name =;
  if (arguments[0] == 'cancel') {
    return this.each(function() {
      var self = $(this);
      var render =;
      if (render) {;
  } else {
    return this.each(function() {
      var node = $(this);
      var render =;
      if (!render) {
        render = {
          callbacks: $.Callbacks(),
          observer: new MutationObserver(function(mutations) {
            mutations = mutations.filter(function(mutation) {
              return mutation.type == 'attributes' &&
                     mutation.attributeName == 'class' ||
                     mutation.type != 'attributes';

            // if recalculating wait for next mutation
            if (mutations.length &&
                (!(node.hasClass('recalculating') ||
                   node.find('.recalculating').length) ||
                 settings.strict)) {
                  if (settings.check(node)) {
                    if (settings.oneTime) {
                      node.onRender('cancel', settings);
        };[0],;, render);

// table copied from dev tools of demo shiny app
var table = `<table class="table shiny-table table- spacing-s" style="width:auto;">
    <thead> <tr> <th style="text-align: right;"> v1 </th> <th style="text-align: left;"> v2 </th> <th style="text-align: left;"> v3 </th>  </tr> </thead> <tbody>
    <tr> <td align="right"> 1.00 </td> <td> a </td> <td> TRUE </td> </tr>
    <tr> <td align="right"> 2.00 </td> <td> b </td> <td> TRUE </td> </tr>
    <tr> <td align="right" class="NA"> NA </td> <td> c </td> <td> FALSE </td> </tr>
    <tr> <td align="right"> 9.00 </td> <td> d </td> <td class="NA"> NA </td> </tr>
    <tr> <td align="right" class="NA"> NA </td> <td> e </td> <td> FALSE </td> </tr>
    <tr> <td align="right"> 7.00 </td> <td class="NA"> NA </td> <td> TRUE </td> </tr>
    </tbody> </table>`;

// this code runs once and it's running each time table is updated
$('#table').onRender(function() {
        theme: 'blue'
}, {
    oneTime: false

// simulate shiny table update
$('button').click(function() {
    var $table = $('#table').addClass('recalculating');
    setTimeout(function() {
    }, 2000);