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

              
                // 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.justify-content-center.h-100
    // The entry point for our Vue app
    #app
      div
        // Notice how we have bound text to the selected value
        b-dropdown#ddown1.m-md-2(:text='selected', variant='warning', size='lg')
          // Add some padding to space out the form nicely inside the dropdown
          b-nav-form.p-3
            // 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
          b-dropdown-item(v-for='i in filteredItems', :key='i', @click='select(i)')
            | {{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}}
            | "
    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 */
.dropdown-menu form {
  position: sticky;
  top: 0;
  background: white;
}

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

JS

              
                

new Vue({
  el: '#app',
  data() {
    return {
      // The search term entered by the user
      searchTerm: '',
      items: rawItems,
      selected: 'Expand Me'
    }
  },
  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;
    }
  },
  methods: {
    /**
    Called when the user clicks an item to select it
    Update the selected value and clear the search bar
    **/
    select(value) {
      this.selected = value;
      this.searchTerm = ''
    },
    
    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 = ''
    }
  }
})
              
            
!
999px

Console