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


Add 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 or require. We'll also process your JavaScript with Babel.

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


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.

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.

              <form action="#0" id="voting-form" class="voting-form">
  <h1>Which of these emojis is your favorite?</h1>
    <select name="emoji_choice" id="emoji_choice">
      <option value="👯">👯</option>
      <option value="🍑">🍑</option>
      <option value="💥">💥</option>
      <option value="🍕">🍕</option>
      <option value="☠️">☠️</option>
    <input type="submit" value="Vote">

<div class="chart">
  <h2>The last 100 votes</h2>
              body {
  font-family: Sans-Serif;
  margin: 0;
h1, h2 {
  font-size: 20px;

.voting-form {
  background: #eee;
  padding: 20px;
  margin: 0 0 20px 0;
select {
  width: 200px;
  text-align: center;

.chart {
  padding: 20px;
.chart div {
  font-size: 20px;
  text-align: right;
  padding: 5px;
  margin: 0 0 3px 0;
  color: white;
.chart div:nth-of-type(1) {
  background-color: #FDBE1A;
.chart div:nth-of-type(2) {
  background-color: #F2B6A0;
.chart div:nth-of-type(3) {
  background-color: #FFD85A;
.chart div:nth-of-type(4) {
  background-color: #830C07;
.chart div:nth-of-type(5) {
  background-color: #999999;


// sort with _createdTime ??
var airtable_read_endpoint = "";

var airtable_write_endpoint = "";

// Write API
var form = document.querySelector("#voting-form");
var select = document.querySelector("#emoji_choice");
form.addEventListener("submit", function(event) {
  event.preventDefault();, {
    "fields": {
      "Emoji Choice": select.options[select.selectedIndex].value
  .then(function(response) {
    // give it a little bit for data to hit AirTable
    setTimeout(function() {
    }, 750);

var pollData = {};
var chartData = [];

function getDataAndBuild() {
  // zero out data
  pollData = {
    "👯": 0,
    "🍑": 0,
    "💥": 0, 
    "🍕": 0, 
    "☠️": 0
  emojis = ["👯", "🍑", "💥", "🍕", "☠️"];
  chartData = [0, 0, 0, 0, 0];
  console.log("Getting data");
    .then(function(result) {
      console.log("Got data (showing first record): ",[0]);, index) {
        pollData[element.fields["Emoji Choice"]]++;
      console.log("Updated poll data: ", pollData);

      // Turn Object into Array (for chart)
      var i = 0;
      for (var prop in pollData) {
        chartData[i] = pollData[prop];
      console.log("Made chart data: ", chartData);


function buildChart(data) {
  console.log("Building chart with this data: ", data);
  var x = d3.scale.linear()
    .domain([0, d3.max(data)])
    .range([0, 400]);
  // Wait a sec? Apparently d3 needs to catch its breath.
  setTimeout(function() {
      .style("width", function(d) { 
        return x(d) + "px"; 
      .text(function(d, i) {
        return emojis[i] + " " + d; 
   }, 200);

// Kick things off!