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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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 id="app"></div>


                * {
  margin: 0;
  padding: 0;

body {
  padding: 2vh;
  background: #1b1b1b;
  color: #ffffff;
  padding: 5vh 2vh;
  font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;

.collection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-gap: 30px;
  max-width: 1200px;
  margin: 50px auto;

.item {
  display: grid;
  grid-template-columns: 110px 1fr;
  grid-gap: 10px;
  margin-bottom: 0;
  background: rgba(225, 225, 225, 0.1);
  padding: 10px;
  border-radius: 6px;
img {
  max-width: 100%;
  height: auto;

h3 {
  font-size: 16px;
  margin-bottom: 5px;

p {
  font-size: 14px;
  line-height: 21px;

a {
  display: table;
  margin-top: 20px;
  text-decoration: none;
  color: white;
  border: 2px solid rgba(225, 225, 225, 0.1);
  border-radius: 100px;
  padding: 5px 15px;
  text-transform: uppercase;
  font-size: 10px;

a:hover {
  background: white;
  border-color: white;
  color: black;

input {
  display: block;
  width: 100%;
  margin-bottom: 40px;
  appearance: none;
  min-height: 60px;
  border: 0;
  border-radius: 3px;
  font-size: 22px;
  font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;
  padding: 0 25px;
  outline: 0;
  max-width: 1200px;
  margin: 0 auto;
  color: #1b1b1b;

.loading {
  background: transparent;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  height: 30px;
  width: 30px;
  border: 5px solid white;
  border-top: 5px solid transparent;
  border-radius: 100px;
  animation: rotate 600ms linear infinite;

@keyframes rotate {
  to {
    transform: rotate(1turn);


                const API = ``;

class App extends React.Component {
  constructor(props) {

    this.state = {
      items: [],
      loading: false

    this.handleSubmit = this.handleSubmit.bind(this);

  api(value) {
    fetch(API + `${value}&limit=15&media=music&country=gb`)
      .then(response => response.json())
      .then(data => {
          items: data.results,
          loading: false

  handleSubmit(e) {
      items: [],
      loading: true

  render() {
    const items = this.state.items;
    const loading = this.state.loading;

    return (
        <form onSubmit={this.handleSubmit}>
            placeholder="Search for an artist, track or album..."

        {loading && <span className="loading" />}

        <div className="collection">
          { => (
            <div className="item" key={item.collectionId}>
              <img src={item.artworkUrl100} />
                <p>by {item.artistName}</p>
                <a href={item.trackViewUrl} target="_blank">
                  {item.isStreamable ? ` Play` : `Buy $${item.trackPrice}`}

ReactDOM.render(<App />, document.getElementById(`app`));