cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


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.

              <script src="https://derbyjs.github.io/derby-standalone/dist/0.6.0-alpha40/derby-standalone.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:400,700' rel='stylesheet' type='text/css'>

<!-- we create a template to use as the body -->
<script type="text/template" id="body">
  <tabs selectedIndex="{{0}}">
    <pane title="One"><b>Hi</b></pane>
    <pane title="Two">ho</pane>
    <pane title="Three">away</pane>
    <pane title="Four">we <span class="highlight">{{_page.punchline}}!</span></pane>

<!-- define a component to use in our body -->
<script type="text/template" id="tabs" data-element="tabs" data-arrays="pane">
  {{each @pane as #pane, #i}}
    <div class="tabs-pane {{if #i === selectedIndex}}active{{/}}">    {{#pane.content}}
  <ul class="tabs">
    {{each @pane as #pane, #i}}
      here we use some template logic to decide a class.
      we also define clicking behavior by calling the select function defined in the code.
      <li class="{{if #i === selectedIndex}}active{{/}}" on-click="select(#i)">

body {
  font-family: "Source Sans Pro";
.tabs {
  list-style: none;
  padding: 0;
.tabs > li {
  display: inline-block;
  padding: 10px;
  background: #192F41;
  color: #C8EBF3 ;
  cursor: default;
.tabs > li.active {
  background: #157EBF;
  color: white;
.tabs-pane {
  display: none;
  font-size: 30px;
  padding: 20px 0;
.tabs-pane.active {
  display: block;
.highlight {
  color: #F2627C;

              // https://github.com/derbyjs/derby-standalone
var app = derby.createApp();
// convenience function for loading templates that are defined as <script type="text/template">

// we register our "tabs" component by associating the Tabs class with the 'tabs' template
app.component('tabs', Tabs);
function Tabs() {}
Tabs.prototype.init = function(model) {
  // init is called at the time of instanciation
  model.setNull('selectedIndex', 0);
Tabs.prototype.create = function() {
  // called when the DOM is ready
Tabs.prototype.select = function(i) {
  // we've defined a view function, i.e. a function that can be called from the view
  this.model.set('selectedIndex', i);

var page = app.createPage();

//this attaches your rendered templates to the body. You could instead append the templates into the div of your choice

page.model.set('_page.punchline', 'go');


Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................