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


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="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 -> 

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

const url       = ""; // 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">${}</h4>
                <p class="card-text">${} 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)