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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                // Center the dropdown vertically and horizontally using bootstrap flex utilities
// Scroll to the bottom inside this pane to see the array of items
html
  head
  body.d-flex.flex-column.align-items-center.h-100
    // The entry point for our Vue app
    #app(v-cloak='')
      div
        // Notice how we have bound text to the selected value
        b-dropdown#ddown1.m-md-2(:text='selectedText', variant='warning', size='lg')
          // Add some padding to space out the form nicely inside the dropdown
          b-nav-form.px-3.py-1
            b-badge(v-for="s in selected" :key="s" variant="warning" class="my-1" pill) 
              div.d-flex.align-items-center
                div.flex-grow-1.px-2 {{s}}
                div(@click="unselect(s)")
                  i.fa.fa-times
          b-nav-form.stucky-top.px-3.py-1
            
            
              // Notice how our v-model is linked directly with the searchTerm property in the Vue instance
              b-form-input.mr-sm-2(type='text', placeholder='Search', v-model='searchTerm')
              b-button.mr-4(variant='outline-none', type='submit', @click.prevent='clearSearch')
                i.fa.fa-times-circle
          // Loop through the filtered items and if clicked select the item and clear the search
          .dropdown-item.bg-white.text-body.d-flex.align-items-center(v-for='i in filteredItems', :key='i', @click='select(i)')
            b-form-checkbox(:value='i', :key='i', v-model='selected')
              | {{split(i, searchTerm)['prefix']}}
              b {{split(i, searchTerm)['term']}}
              | {{split(i, searchTerm)['suffix']}}
          // If we have no search results display this item inside the dropdown
          b-dropdown-header(v-if='filteredItems.length === 0')
            | No results for "
            b {{searchTerm}}
            | "
      p.px-5 You selected {{selected.join(" ") || "nothing"}}
    script.
      window.rawItems = ["ETHBTC", "LTCBTC", "BNBBTC", "NEOBTC", "QTUMETH", "EOSETH", "SNTETH", "BNTETH", "BCCBTC", "GASBTC", "BNBETH", "BTCUSDT", "ETHUSDT", "HSRBTC", "OAXETH", "DNTETH", "MCOETH", "ICNETH", "MCOBTC", "WTCBTC", "WTCETH", "LRCBTC", "LRCETH", "QTUMBTC", "YOYOBTC", "OMGBTC", "OMGETH", "ZRXBTC", "ZRXETH", "STRATBTC", "STRATETH", "SNGLSBTC", "SNGLSETH", "BQXBTC", "BQXETH", "KNCBTC", "KNCETH", "FUNBTC", "FUNETH", "SNMBTC", "SNMETH", "NEOETH", "IOTABTC", "IOTAETH", "LINKBTC", "LINKETH", "XVGBTC", "XVGETH", "SALTBTC", "SALTETH", "MDABTC", "MDAETH", "MTLBTC", "MTLETH", "SUBBTC", "SUBETH", "EOSBTC", "SNTBTC", "ETCETH", "ETCBTC", "MTHBTC", "MTHETH", "ENGBTC", "ENGETH", "DNTBTC", "ZECBTC", "ZECETH", "BNTBTC", "ASTBTC", "ASTETH", "DASHBTC", "DASHETH", "OAXBTC", "ICNBTC", "BTGBTC", "BTGETH", "EVXBTC", "EVXETH", "REQBTC", "REQETH", "VIBBTC", "VIBETH", "HSRETH", "TRXBTC", "TRXETH", "POWRBTC", "POWRETH", "ARKBTC", "ARKETH", "YOYOETH", "XRPBTC", "XRPETH", "MODBTC", "MODETH", "ENJBTC", "ENJETH", "STORJBTC", "STORJETH", "BNBUSDT", "VENBNB", "YOYOBNB", "POWRBNB", "VENBTC", "VENETH", "KMDBTC", "KMDETH", "NULSBNB", "RCNBTC", "RCNETH", "RCNBNB", "NULSBTC", "NULSETH", "RDNBTC", "RDNETH", "RDNBNB", "XMRBTC", "XMRETH", "DLTBNB", "WTCBNB", "DLTBTC", "DLTETH", "AMBBTC", "AMBETH", "AMBBNB", "BCCETH", "BCCUSDT", "BCCBNB", "BATBTC", "BATETH", "BATBNB", "BCPTBTC", "BCPTETH", "BCPTBNB", "ARNBTC", "ARNETH", "GVTBTC", "GVTETH", "CDTBTC", "CDTETH", "GXSBTC", "GXSETH", "NEOUSDT", "NEOBNB", "POEBTC", "POEETH", "QSPBTC", "QSPETH", "QSPBNB", "BTSBTC", "BTSETH", "BTSBNB", "XZCBTC", "XZCETH", "XZCBNB", "LSKBTC", "LSKETH", "LSKBNB", "TNTBTC", "TNTETH", "FUELBTC", "FUELETH", "MANABTC", "MANAETH", "BCDBTC", "BCDETH", "DGDBTC", "DGDETH", "IOTABNB", "ADXBTC", "ADXETH", "ADXBNB", "ADABTC", "ADAETH", "PPTBTC", "PPTETH", "CMTBTC", "CMTETH", "CMTBNB", "XLMBTC", "XLMETH", "XLMBNB", "CNDBTC", "CNDETH", "CNDBNB", "LENDBTC", "LENDETH", "WABIBTC", "WABIETH", "WABIBNB", "LTCETH", "LTCUSDT", "LTCBNB", "TNBBTC", "TNBETH", "WAVESBTC", "WAVESETH", "WAVESBNB", "GTOBTC", "GTOETH", "GTOBNB", "ICXBTC", "ICXETH", "ICXBNB", "OSTBTC", "OSTETH", "OSTBNB", "ELFBTC", "ELFETH", "AIONBTC", "AIONETH", "AIONBNB", "NEBLBTC", "NEBLETH", "NEBLBNB", "BRDBTC", "BRDETH", "BRDBNB", "MCOBNB", "EDOBTC", "EDOETH", "WINGSBTC", "WINGSETH", "NAVBTC", "NAVETH", "NAVBNB", "LUNBTC", "LUNETH", "TRIGBTC", "TRIGETH", "TRIGBNB", "APPCBTC", "APPCETH", "APPCBNB", "VIBEBTC", "VIBEETH", "RLCBTC", "RLCETH", "RLCBNB", "INSBTC", "INSETH", "PIVXBTC", "PIVXETH", "PIVXBNB", "IOSTBTC", "IOSTETH", "CHATBTC", "CHATETH", "STEEMBTC", "STEEMETH", "STEEMBNB", "NANOBTC", "NANOETH", "NANOBNB", "VIABTC", "VIAETH", "VIABNB", "BLZBTC", "BLZETH", "BLZBNB", "AEBTC", "AEETH", "AEBNB", "RPXBTC", "RPXETH", "RPXBNB", "NCASHBTC", "NCASHETH", "NCASHBNB", "POABTC", "POAETH", "POABNB", "ZILBTC", "ZILETH", "ZILBNB", "ONTBTC", "ONTETH", "ONTBNB", "STORMBTC", "STORMETH", "STORMBNB", "QTUMBNB", "QTUMUSDT", "XEMBTC", "XEMETH", "XEMBNB", "WANBTC", "WANETH", "WANBNB", "WPRBTC", "WPRETH", "QLCBTC", "QLCETH", "SYSBTC", "SYSETH", "SYSBNB", "QLCBNB", "GRSBTC", "GRSETH", "ADAUSDT", "ADABNB", "CLOAKBTC", "CLOAKETH", "GNTBTC", "GNTETH", "GNTBNB", "LOOMBTC", "LOOMETH", "LOOMBNB", "XRPUSDT", "BCNBTC", "BCNETH", "BCNBNB", "REPBTC", "REPETH", "REPBNB", "TUSDBTC", "TUSDETH", "TUSDBNB", "ZENBTC", "ZENETH", "ZENBNB", "SKYBTC", "SKYETH", "SKYBNB", "EOSUSDT", "EOSBNB", "CVCBTC", "CVCETH", "CVCBNB", "THETABTC", "THETAETH", "THETABNB", "XRPBNB", "TUSDUSDT", "IOTAUSDT", "XLMUSDT", "IOTXBTC", "IOTXETH", "QKCBTC", "QKCETH", "AGIBTC", "AGIETH", "AGIBNB", "NXSBTC", "NXSETH", "NXSBNB", "ENJBNB", "DATABTC", "DATAETH", "ONTUSDT", "TRXBNB", "TRXUSDT", "ETCUSDT", "ETCBNB", "ICXUSDT", "SCBTC", "SCETH", "SCBNB", "NPXSBTC", "NPXSETH", "VENUSDT", "KEYBTC", "KEYETH", "NASBTC", "NASETH", "NASBNB", "MFTBTC", "MFTETH", "MFTBNB", "DENTBTC", "DENTETH", "ARDRBTC", "ARDRETH", "ARDRBNB", "NULSUSDT", "HOTBTC", "HOTETH", "VETBTC", "VETETH", "VETUSDT", "VETBNB", "DOCKBTC", "DOCKETH", "POLYBTC", "POLYBNB", "PHXBTC", "PHXETH", "PHXBNB", "HCBTC", "HCETH", "GOBTC", "GOBNB", "PAXBTC", "PAXBNB", "PAXUSDT", "PAXETH", "RVNBTC", "RVNBNB", "DCRBTC", "DCRBNB", "USDCBNB", "USDCBTC", "MITHBTC", "MITHBNB", "BCHABCBTC", "BCHSVBTC", "BCHABCUSDT", "BCHSVUSDT", "BNBPAX", "BTCPAX", "ETHPAX", "XRPPAX", "EOSPAX", "XLMPAX", "RENBTC", "RENBNB", "XRPTUSD", "EOSTUSD", "XLMTUSD", "BNBUSDC", "BTCUSDC", "ETHUSDC", "XRPUSDC", "EOSUSDC", "XLMUSDC", "USDCUSDT", "ADATUSD", "TRXTUSD", "NEOTUSD", "TRXXRP", "XZCXRP"]

              
            
!

CSS

              
                html {
  height: 100%;
}

/* Make the dropdown scroll within a fixed height instead of taking all the screen */
.dropdown-menu {
  height: 256px;
  overflow-y: scroll;
  padding-top: 0;
}

/* Fix the search bar at the top inside the dropdown */
.stucky-top {
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}


/* Place the button inside the text box */
.dropdown-menu form .btn {
  position: absolute;
  right: 0;
}

#app p {
  position: absolute;
  left: 0;
  bottom: 0;
}

/* Hide vue syntax while loading */
[v-cloak] {
  display: none;
}
              
            
!

JS

              
                

new Vue({
  el: '#app',
  data() {
    return {
      // The search term entered by the user
      searchTerm: '',
      items: rawItems,
      selectedText: 'Expand Me',
      selected: []
    }
  },
  computed: {
    filteredItems() {
      const filtered =  this.items.filter(i => {
        if(this.searchTerm === '') {
          return this.items
        }
        // Compare everything after converting to lower case
        let lowerI = i.toLowerCase()
        let lowerS = this.searchTerm.toLowerCase()
        // If they are equal of if the item starts with the search term of the item ends with the search term
        return lowerI === lowerS || lowerI.startsWith(lowerS) || lowerI.endsWith(lowerS) || lowerI.includes(lowerS) || lowerS.includes(lowerI)
      })    
      return filtered;
    },
    
    getSelectedText() {
      if(!this.selected) {
        return 'Expand Me'
      }
      else if(this.selected.length === 1) {
        return this.selected[0]
      }
      else {
        return this.selected.length + ' pairs selected'
      }
    }
  },
  methods: {
    /**
    Called when the user clicks an item to select it
    Update the selected value and clear the search bar
    **/
    select(value) {
      this.selectedText = "Expand Me";
      const position = this.selected.indexOf(value)
      if(position >= 0) {
        this.selected.splice(position, 1)
      }
      else {
        this.selected.push(value)
      }
    },
    
    unselect(s) {
      const position = this.selected.indexOf(s)
      this.selected.splice(position, 1)
    },
    
    split (str, search) {
      let strL = str.toLowerCase()
      let srL = search.toLowerCase()
      return {
        prefix: strL.substr(0, strL.indexOf(srL)).toUpperCase(), 
        term: srL.toUpperCase(), 
        suffix: strL.substr(strL.indexOf(srL) + srL.length, strL.length).toUpperCase()
      }
    },
    
    clearSearch() {
      this.searchTerm = ''
    }
  },
  watch: {
    selected(newValue, oldValue) {
      if(newValue.length === 0) {
        this.selectedText = 'Expand Me'
      }
      else if(newValue.length === 1) {
        this.selectedText = newValue[0];
      }
      else {
        this.selectedText = newValue.length + ' items selected'
      }
    }
  }
})
              
            
!
999px

Console