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

              
                <script type="x/template" id="tabset-template">
  <ul class="nav nav-tabs">
    <li :class="{active: current === tab}" v-for="tab in tabs">
      <a href="#" @click.prevent="change(tab)">{{tab.title}}</a>
    </li>
  </ul>
  <div class="tab-content">
    <slot></slot>
  </div>
</script>
<script type="x/template" id="tab-template">
  <!-- if :class is {active: active,in: active}, no animation -->
  <div class="tab-pane fade" v-el:panel :class="{active:active,in:in}">
    <slot></slot>
  </div>
</script>
<div id="tabs">
  <tabset>
    <tab title="Home">
      <p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
    </tab>
    <tab title="Profile">
      <p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
    </tab>
    <tab title="Login">
      <p>Login</p>
    </tab>
  </tabset>
</div>

              
            
!

CSS

              
                
              
            
!

JS

              
                Vue.component('tabset', {
  template: '#tabset-template',
  data: function(){
    return {
      tabs: [],
      current: null
    }
  },
  methods: {
    change: function(tab) {
      this.current = tab;
      this.tabs.forEach(function(_t) {
        _t.active = _t === tab;
      });
    },
    registerTab: function(tab) {
      if (!this.current) {
        this.current = tab;
      }
      this.tabs.push(tab);
    }
  }
});
Vue.component('tab', {
  template: '#tab-template',
  data: function() {
    return {in: false};
  },
  computed: {
    active: function() {
      var isActive = this.$parent.current === this;
      var self = this;

      // or use this method:
      // setTimeout(function() {
      //   self.in = isActive;
      // }, 0);
      this.$nextTick(function() {
        // if is commented, no animation
        this.$els.panel.offsetWidth;  // force css reflow
        this.in = isActive;
      });
      return isActive;
    }
  },
  props: {
    title: {
      type: String,
      required: true
    }
  },
  compiled: function() {
    this.$parent.registerTab(this);
  }
});
new Vue({
  el: '#tabs'
})
              
            
!
999px

Console