Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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 class="heading">
  <h1>Advanced Vue.js v2 Chained Select</h1>
  <h4>Using Vue.js v2 to chain mulitiple select inputs together.</h4>

<div class="container" id="app">
  <p class="lead">Lets play around with an advanced chained select field(s) using Vue.js.</p>
  <hr />
  <h3>Advanced Example</h3>
  <div class="row">
    <div class="col-xs-8 col-xs-offset-2 col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
      <!-- Color Select Input -->
      <div class="form-group">
        <select v-model="user_selected_options.color" class="form-control" @change="retotal">
          <option value="" selected>Select Color</option>
          <option v-for="(color, key) in colors" :value="key">{{ color.color }} {{ '$' + color.price.toFixed(2) }}</option>
      <!-- Size Select Input -->
      <div class="form-group">
        <select v-model="user_selected_options.size" class="form-control" :disabled="!user_selected_options.color" @change="retotal">
          <option value="" selected>Select Size</option>
          <option v-for="(size, key) in sizes" :value="key">{{ size.size }} {{ '$' + size.price.toFixed(2) }}</option>
      <!-- Style Select Input -->
      <div class="form-group">
        <select v-model="" class="form-control" :disabled="!user_selected_options.size" @change="retotal">
          <option value="" selected>Select Style</option>
          <option v-for="(style, key) in styles" :value="key">{{ }} {{ '$' + style.price.toFixed(2) }}</option>
      <!-- Total and Add to Basket button -->
      <div class="input-group" align="center">
        <span class="input-group-addon total">{{ '$' + total.toFixed(2)  }}</span>
        <span class="input-group-btn">
          <button class="btn btn-primary" :disabled="!"><span class="fa fa-shopping-basket"></span> Add to Basket</button>



                $purple: #5c4084;

body {
  background-color: $purple;
  text-align: center;
  padding: 50px;
.container {
  background-color: #fff;
  padding-top: 40px;
  padding-bottom: 40px;
  border-radius: 8px;
.heading {
  h1 {
    color: #fff;
    font-size: 4rem;
    font-weight: 900;
    margin: 0 0 5px 0;
    background: -webkit-linear-gradient(#fff, #999);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
  h4 {
    color: lighten(#5c3d86,30%);
    font-size: 24px;
    font-weight: 400;
    text-align: center;
    margin: 0 0 35px 0;
  outline: none !important;
.btn.btn-primary {
  background-color: $purple;
  border-color: $purple;
  outline: none;
  &:hover {
    background-color: darken($purple, 10%);
    border-color: darken($purple, 10%);
  &:active, &:focus {
    background-color: lighten($purple, 5%);
    border-color: lighten($purple, 5%);
  & .fa {
    padding-right: 2px;
select.form-control {
  cursor: pointer;
.input-group {
  display: block;
.input-group-addon, .input-group-btn {
  width: auto;
} {
  font-weight: bold;



                new Vue({
  el: '#app',
  data: {
    colors: {
      red: {color: 'Red', price: 1},
      blue: {color: 'Blue', price: 1},
      green: {color: 'Green', price: 1},
      purple: {color: 'Purple', price: 2.5}
    sizes: {
      xsmall: {size: 'X-Small', price: 5},
      small: {size: 'Small', price: 10},
      Medium: {size: 'Medium', price: 10},
      large: {size: 'Large', price: 12},
      xlarge: {size: 'X-Large', price: 15},
      xxlarge: {size: 'XX-Large', price: 18}
    styles: {
      crew_neck: {style: 'Crew Neck', price: 5},
      v_neck: {style: 'V Neck', price: 5}
    user_selected_options: {
      color: '',
      size: '',
      style: '',
      quantity: 0
    total: 0
  methods: {
    retotal: function() {
      let newTotal = 0;
      if(this.user_selected_options.color) {
        newTotal = newTotal + this.colors[this.user_selected_options.color].price;
      if(this.user_selected_options.size != '') {
        newTotal = newTotal + this.sizes[this.user_selected_options.size].price;
      if( != '') {
        newTotal = newTotal + this.styles[].price;
      } = newTotal;