Pen Settings

HTML

CSS

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

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.

HTML

              
                <div id="app" class="container p-5">
  <button class="btn btn-info" @click="toggleAccord" v-if="expanded">Collapse all</button>
  <button class="btn btn-info" @click="toggleAccord" v-if="!expanded">Expand all</button>
  <hr />
  <div class="accordion">
    <accordioncard v-for="kit in kits" :card-data="kit"></accordioncard>
  </div>
</div>
<template id="accordioncards">
  <!--  Accordion Card Start  -->
  <div class="card">
    <div class="card-header p-0">
      <a class="kit-toggle" href="#" @click.prevent="active=!active">
        <div>
          <span class="kit-code">{{ cardData.code }}</span>
          {{ cardData.name }} <span :class="kitStatus">{{ cardData.status }}</span>
        </div>
        <div>
          Component Types: <span :class="kitItem">{{ cardData.itemCount }}</span>
        </div>
      </a>
    </div>
    <transition name="collapse">
      <div v-show="active">
        <div class="kit-contents card-body row align-items-stretch">
          <!-- Items/Destinations Tabs -->
          <div class="col-12 col-lg-8 mb-3 d-flex flex-column">
            <ul class="nav nav-tabs" role="tablist">
              <!-- Items Tab -->
              <li class="nav-item">
                <h5 class="m-0">
                  <a
                    :class="['nav-link', itemDest === 1 ? 'active': '']"
                    @click.prevent="itemDest = 1"
                    href="#"
                    >Kit Items</a
                  >
                </h5>
              </li>
              <!-- Destinations Tab -->
              <li class="nav-item">
                <h5 class="m-0">
                  <a
                    :class="['nav-link', itemDest === 2 ? 'active': '']"
                    @click.prevent="itemDest = 2"
                    href="#"
                    >Kit Destinations</a
                  >
                </h5>
              </li>
            </ul>
            <!-- Items Content -->
            <div class="tab-content">
              <div v-show="itemDest === 1" class="border border-top-0 p-3">
                <ul class="border rounded items-list list-group flex-grow-1 mb-3">
                  <li class="list-group-item border-0" v-for="item in cardData.items">
                    {{ item.id }}: {{ item.name }}
                  </li>
                </ul>
                <button class="btn btn-primary">Add items</button>
              </div>
              <div v-show="itemDest === 2" class="border border-top-0 p-3">
                <ul class="border rounded items-list list-group flex-grow-1 mb-3">
                  <li class="list-group-item border-0" v-for="dest in cardData.destinations">
                   {{dest.code}} {{dest.addresss}} {{dest.lang}}
                  </li>
                </ul>
                <button class="btn btn-primary">Add destinations</button>
              </div>
            </div>
          </div>
          <!-- Add/Remove Tabs -->
          <div class="col-12 col-lg-4 align-items-stretch">
            <ul class="nav nav-tabs" role="tablist">
              <!-- Add Tab -->
              <li class="nav-item">
                <a
                  :class="['nav-link',  addRemove === 1 ? 'active': '']"
                  @click.prevent="addRemove = 1"
                  href="#"
                  >Add</a
                >
              </li>
              <!-- Remove Tab -->
              <li class="nav-item">
                <a
                  :class="['nav-link',  addRemove === 2 ? 'active': '']"
                  @click.prevent="addRemove = 2"
                  href="#"
                  >Remove</a
                >
              </li>
            </ul>
            <div class="tab-content">
              <!-- Add contents -->
              <div v-show="addRemove === 1" class="border border-top-0 p-3">
                <div class="form-group">
                  <label>Enter stores to add to kit:</label>
                  <textarea class="form-control text-monospace" rows="8"></textarea>
                </div>
                <div class="d-flex justify-content-end">
                  <button class="btn btn-primary">Add stores</button>
                </div>
              </div>
              <!-- Remove contents -->
              <div v-show="addRemove === 2" class="border border-top-0 p-3">
                <div class="form-group">
                  <label>Enter stores to remove from kit</label>
                  <textarea class="form-control text-monospace" rows="8"></textarea>
                </div>
                <div class="d-flex justify-content-end">
                  <button class="btn btn-danger ml-auto">Remove stores</button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </transition>
  </div>
</template>

              
            
!

CSS

              
                .collapse-enter-active,
.collapse-leave-active {
  transition: max-height 200ms;
  max-height: 26rem;
  overflow: hidden;
}
.collapse-enter,
.collapse-leave-to {
  max-height: 0px;
  overflow: hidden;
}

.kit-toggle {
  color: #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  &:hover {
    background-color: #ddd;
    text-decoration: none;
    color: #000;
  }

  .kit-code {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid #555;
    display: inline-block;
    color: #555;
    border-radius: 1.25rem;
    text-align: center;
    line-height: 2.25rem;
    margin-right: 0.5rem;
  }
  .item-count{
    font-size: .9rem;
  }
}
.kit-contents{
  min-height: 26rem;
}
.items-list{
  max-height: 14.8rem;
  min-height: 5rem;
  overflow: auto;
  & li:nth-child(odd){
    background: #eee;
  }
}

              
            
!

JS

              
                const eventBus = new Vue();
Vue.component("accordioncard", {
  template: "#accordioncards",
  props: ["cardData"],
  data: function() {
    return {
      active: false,
      addRemove: 1,
      itemDest: 1,
      addStores: true,
      removeStores: false
    };
  },
  computed: {
    kitItem: function() {
      return [
        "item-count",
        "badge",
        "badge-pill",
        this.cardData.itemCount > 0 ? "badge-secondary" : "badge-danger"
      ];
    },
    kitStatus: function() {
      return [
        "badge",
        "ml-2",
        this.cardData.status === "active" ? "badge-primary" : "badge-danger"
      ];
    }
  },
  created: function() {
    eventBus.$on("activeFalse", () => (this.active = false));
    eventBus.$on("activeTrue", () => (this.active = true));
  }
});

const app = new Vue({
  el: "#app",
  data: {
    expanded: false,
    show: true,
    kits: [
      {
        code: "A",
        name: "Campaign kit: 000002",
        status: "active",
        itemCount: 8,
        items: [
          { id: "R1234_001", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Barker Card- No Frills" },
          { id: "R1234_005", name: "Barker Card with flag - Clear PVC" },
          { id: "R1234_002", name: "Acetate - Large" },
          { id: "R1234_002", name: "Hardware - PRODUCE POD- DISCOUNT" },
          { id: "R1234_002", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Meat Divider - Short" }
        ],
                destinations: [
          { code:'YIG', addresss: '31 NINTH ST E	ON',	lang:	'English'},
          { code:'YIG', addresss: '31 NINTH ST E	ON',	lang:	'English'},
          { code:'YIG', addresss: '31 NINTH ST E	ON',	lang:	'English'},
          { code:'YIG', addresss: '31 NINTH ST E	ON',	lang:	'English'}
        ]
      },
      {
        code: "B",
        name: "RCSS ON",
        status: "active",
        itemCount: 12,
        items: [
          { id: "R1234_001", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Barker Card- No Frills" },
          { id: "R1234_005", name: "Barker Card with flag - Clear PVC" },
          { id: "R1234_002", name: "Acetate - Large" },
          { id: "R1234_002", name: "Hardware - PRODUCE POD- DISCOUNT" },
          { id: "R1234_002", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Meat Divider - Short" },
          { id: "R1234_002", name: "Hardware - PRODUCE POD- DISCOUNT" },
          { id: "R1234_002", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Meat Divider - Short" },
          { id: "R1234_002", name: "Barker Card- No Frills" }
        ],
        destinations: [
          { code:'YIG', addresss: '31 NINTH ST E	ON',	lang:	'English'},
          { code:'YIG', addresss: '31 NINTH ST E	ON',	lang:	'English'},
          { code:'YIG', addresss: '31 NINTH ST E	ON',	lang:	'English'},
          { code:'YIG', addresss: '31 NINTH ST E	ON',	lang:	'English'}
        ]
      },
      {
        code: "C",
        name: "RCSS W",
        status: "inactive",
        itemCount: 1,
        items: [
          { id: "R1234_001", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Barker Card- No Frills" }
        ]
      },
      {
        code: "D",
        name: "Campaign kit: 000008",
        status: "active",
        itemCount: 0
      },
      {
        code: "AA",
        name: "Custom kit name",
        status: "active",
        itemCount: 8,
        items: [
          { id: "R1234_001", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Barker Card- No Frills" },
          { id: "R1234_005", name: "Barker Card with flag - Clear PVC" },
          { id: "R1234_002", name: "Acetate - Large" },
          { id: "R1234_002", name: "Hardware - PRODUCE POD- DISCOUNT" },
          { id: "R1234_002", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Meat Divider - Short" },
          { id: "R1234_002", name: "Hardware - PRODUCE POD- DISCOUNT" },
          { id: "R1234_002", name: "Barker Card- No Frills" },
          { id: "R1234_002", name: "Meat Divider - Short" },
          { id: "R1234_002", name: "Barker Card- No Frills" }
        ]
      }
    ]
  },
  methods: {
    toggleAccord: function() {
      if (this.expanded) {
        eventBus.$emit("activeFalse");
      } else {
        eventBus.$emit("activeTrue");
      }
      this.expanded = !this.expanded;
    },
    collapseAll: function() {
      eventBus.$emit("activeFalse");
    },
    expandAll: function() {
      eventBus.$emit("activeTrue");
    }
  }
});

              
            
!
999px

Console