Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                
<div id="app">
  <!--
    A data-table example using it's props and @select handler
  -->
  <data-tablee
    :cols="cols"
    :rows="rows"
    selectable
    @select="(items) => selected = items"
  ></data-tablee>

  <!--
    This is just an example that you can do using
    VueDataTablee @select handler...
  -->
  <transition-group
    tag="ul"
    name="selected-users"
    class="selected-users"
  >
    <li class="label" :key="'label'">Selected users:</li>
    <li
      v-for="name in selected.map((_) => _.name)"
      class="user"
      :key="name"
    >{{ name }}</li>
  </transition-group>

  <!--
    another example using rows as slots
  -->
  <data-tablee
    :cols="[
      { label: 'Index', sort: false },
      { label: 'Name', field: 'name' }
    ]"
    :rows="rows"
  >
    <template slot="row" slot-scope="{ row, index }">
      <td class="data-tablee-cell">
        <span class="data-tablee-text">{{ index + 1 }}</span>
      </td>
      <td class="data-tablee-cell">
        <span class="data-tablee-text">{{ row.name }}</span>
      </td>
    </template>
  </data-tablee>
</div>
              
            
!

CSS

              
                // Centralize stuff
#app
  display flex
  flex-direction row
  justify-content space-around
  align-items center

.selected-users
  margin 0
  padding 0
  
  &-active
  &-active
    transition transform .5s ease,
               opacity .5s ease
    
  &-enter
  &-leave-to
    opacity 0
  
  > .label
    list-style: none
    text-align: center

  > .user
  > .label
    transition: all .5s ease
    font-family: sans-serif

              
            
!

JS

              
                Vue.use(vueDataTablee);

const getTime = date => new Date(date).getTime()

new Vue({
  el: "#app",
  data() {
    return {
      selected: [],
      cols: [
        {
          label: "Name",
          field: "name",
          width: 150
        },
        {
          label: "Birth Date",
          field: "birth_date",
          sort: (a, b) => getTime(a) - getTime(b)
        },
        {
          label: "Gender",
          field: "gender",
          sort: false
        },
        {
          label: "City",
          field: "address.city"
        }
      ],
      rows: getUsers()
    };
  }
});

function getUsers() {
  return [
    {
      id: "daa3daeb-91c6-42f8-aaf4-4e80c297c000",
      name: "Darsie Tellett",
      email: "dtellett1@behance.net",
      gender: "Male",
      birth_date: "1990-07-12",
      address: {
        country: "United States",
        zip: "84130",
        province: "Utah",
        city: "Salt Lake City",
        street: "Schurz",
        number: "08529"
      }
    },
    {
      id: "37742e75-6839-461a-8727-d00b4333176a",
      name: "Hilarius Jeaffreson",
      email: "hjeaffreson2@ted.com",
      gender: "Male",
      birth_date: "1993-06-13",
      address: {
        country: "United States",
        zip: "34290",
        province: "Florida",
        city: "North Port",
        street: "Milwaukee",
        number: "0"
      }
    },
    {
      id: "a6ebf9ee-3cc5-4384-b73c-594a79207774",
      name: "Lyman Haxley",
      email: "lhaxley3@newyorker.com",
      gender: null,
      birth_date: "1972-12-29",
      address: {
        country: "United States",
        zip: "77260",
        province: "Texas",
        city: "Houston",
        street: "Scoville",
        number: "9514"
      }
    },
    {
      id: "77b39998-188a-4967-a960-12372308345c",
      name: "Lock Kearney",
      email: "lkearney4@ucsd.edu",
      gender: "Male",
      birth_date: "1983-01-17",
      address: {
        country: "United States",
        zip: "43215",
        province: "Ohio",
        city: "Columbus",
        street: "5th",
        number: "36"
      }
    },
    {
      id: "df88b137-fc34-4bd4-b32a-595f79867906",
      name: "Ame Blachford",
      email: "ablachford5@miitbeian.gov.cn",
      gender: "Female",
      birth_date: "1974-03-04",
      address: {
        country: "United States",
        zip: "32803",
        province: "Florida",
        city: "Orlando",
        street: "Hovde",
        number: "6251"
      }
    },
    {
      id: "d18a89e9-a707-4bed-9b75-73a1e712714b",
      name: "Bobbye Seldon",
      email: "bseldon6@artisteer.com",
      gender: "Male",
      birth_date: "1993-07-23",
      address: {
        country: "United States",
        zip: "83757",
        province: "Idaho",
        city: "Boise",
        street: "Delaware",
        number: "9754"
      }
    }
  ];
}

              
            
!
999px

Console