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. 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

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.

              <div class="main-container">
  <div class="wrapper card">
    <h2 class="page-title">
      Spotify Search
      <small>Lookup your favorite tracks, artists and albums</small>
    <div class="md-form">
      <input type="text" id="search-input" class="form-control">
      <label for="search-input">Search Here</label>
  <!-- /.wrapper -->
  <div id="rendered-content" class="js-card-content"></div>
              /* pre defined styles */

.main-container {
  width: 100%;
  font-family: 'Raleway', sans-serif;

.wrapper {
  border: 1px solid #AAA;
  margin: 20px auto;
  padding: 10px;
  width: 80%;

input {
  background: transparent;
  border-top: 0;
  border-left: 0;
  border-bottom: 2px solid #66FF33;
  display: block;
  margin: 5px auto;
  outline: transparent;
  padding: 10px;
  text-align: center;
  width: 50%;
  transition: .2s ease;

input:focus {
  font-size: 20px;
  font-weight: bold;
  transition: .2s ease;

/* Typography */
.page-title {
  font-weight: bold;
  text-align: center;

small {
  color: #84bd00;
  display: block;

/* Create  your own styles here --> See the JS code for class names
.js-card-content {
  margin-top: 50px;

.card-content {
  margin: 10px 0;
              // code up a get request from Spotify API
// see API sandboxhere -> https://developer.spotify.com/web-api/console/get-search-item/?q=tania%2A&type=artist#complete 

/* Take a look at the code, you will see below where you can modify it

const url       = "https://api.spotify.com/v1/search?q="; // api base url
const searchBox = document.getElementById("search-input");
const content   = document.getElementById("rendered-content");

searchBox.addEventListener('keyup', function() {
  const searchTerm = searchBox.value; // the value from the searchbox
  content.innerHTML += ""; // reset the dynamic data on each new API call

  // fetch the url, with the searchterm, and specify artist / song / album as well as the limit
  fetch(url + searchTerm + "*&type=artist")
    .then(response => response.json()) // turn API data into JSON
    .then((data) => {
      // use dot notation to look into the json data
      let results = data.artists.items;
       results.forEach(artist => content.innerHTML +=      
        /* Don't change any code ABOVE this line!
         * Create something beautiful with the following HTML, 
         * feel free to change the HTML tags if you need to.
        `<div class="col-sm-4">
            <div class="card">
              <!--Card image-->
              <div class="view overlay hm-white-slight">
                <img src=" ${artist.images[0].url} " class="img-fluid" alt="">
                <a href="${artist.images[0].url}" target="_blank">
                  <div class="mask"></div>

              <!--Card content-->
              <div class="card-block">
                <h4 class="card-title">${artist.name}</h4>
                <p class="card-text">${artist.followers.total} Followers</p>
                <p class="card-text">Popularity: ${artist.popularity}</p>
                <a href="${artist.external_urls.spotify}" class="btn btn-indigo">View Artist</a>
       /* Don't change any code BELOW this line! 
    .catch(err => console.log('Fetch Error :-S', err)); // catch an error (see console if error occurs) 
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.