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.


                <div id='description'>
  <p>The library provide <code>'light'</code> (default) and <code>'dark'</code> as theme.</p>
  <p>The theme is set to <code>'dark'</code>.</p>
  <div id='chart'></div>
  <p>More info about theme can be found <a href ="" target="_blank">here.</a></p>
<div><p>The theme can also be applied to the whole page by changing the style.</p></div>  
<div><button onclick="useTheme('light');return false;" class='rs-btn--small rs-btn--selected'>Light Theme</button>
      <button onclick="useTheme('dark');return false;" class ='rs-btn--small'>Dark Theme</button>  
 <div><p>The light theme uses the default style and dark theme uses a different library adding <code>ui-rs-core-dark.min.css</code> after <code>css/</code> which just add <code>-dark</code> to the style link.</p></div>   


                #description {
  margin: 1em;

  width: 100px;



//change the theme; available theme 'light' or 'dark' 

let dataSet = [
                { "y": "Plan", "x": "Jan", "z": 100},
                { "y": "Bonus", "x": "Feb", "z": 460},
                { "y": "Plan", "x": "Mar", "z": 720},

let chart = d3_rs_squares.html()
                         .theme('dark')  //using the'dark' theme             
                         .width(400)  //set the width
                         .height(250);  //set the height'#chart')

//toggling to different theme
function useTheme(themeName) {
  [] => {
    if (style.href) {
      if (style.href.startsWith('')) {
        style.disabled = true;
        if (style.href.endsWith('ui-rs-core.min.css') && themeName === 'light') {
          style.disabled = false;
        } else if (style.href.endsWith('ui-rs-core-dark.min.css') && themeName === 'dark') {
          style.disabled = false;

// Generic function to toggle selected state of a button
  .on('click', function() {
    let selected = this;
      .classed('rs-btn--selected', function() {
        return (selected === this);