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.

              <!-- Simple template for the ListView instantiation  -->
<div class="smallListIconTextTemplate" 
     style="display: none">
    <div class="smallListIconTextItem">
        <span class="date-picker">
          <img src="#" 
             class="smallListIconTextItem-Image date-picker" 
             data-win-bind="src: picture"
        <div class="smallListIconTextItem-Detail">
            <h4 class="win-h4" data-win-bind="textContent: title"></h4>
            <h6 class="win-h6" data-win-bind="textContent: text"></h6>

<div class="listLayoutTopHeaderTemplate" data-win-control="WinJS.Binding.Template">
    <div class="listLayoutTopHeaderTemplateRoot">
        <div data-win-bind="innerHTML: title"></div>

<!-- Elements used for header and footer elements for ListView -->
<div class="headerFooterPlaceholder">
    <div class="header">
        <h2 class="win-h2" style="text-overflow: ellipsis;">Ordered ListView with Simulated Loading</h2>
            <span>Total Items: </span>
            <span data-win-bind="textContent: data.length"></span>
    <div class="footer">
        <div class="status">
            <div>Loading more items </div>
            <progress class="win-progress-bar progress hide"></progress>

<div id="listView"
     class="listView win-selectionstylefilled"
            itemTemplate: select('.smallListIconTextTemplate'),
            header: select('.header'),
            footer: select('.footer'),
            layout: { type: WinJS.UI.ListLayout, groupHeaderPosition: 'top'},
            groupHeaderTemplate: select('.listLayoutTopHeaderTemplate'),                        
            selectionMode: 'none',
            tapBehavior: 'none'

              /* Template for the items in the ListViews in this sample */       
    width: 100%;
    height: 70px;
    padding: 5px;
    overflow: hidden;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;

    .smallListIconTextItem img.smallListIconTextItem-Image 
        width: 64px;
        height: 64px;
        margin: 5px;

    .smallListIconTextItem .smallListIconTextItem-Detail
        margin: 5px;

   .listLayoutTopHeaderTemplateRoot, .gridLayoutLeftHeaderTemplateRoot {
        font-size: larger;
        margin-left: 16px;
/* CSS applied to the ListViews in this sample */
    height: 100%;

.headerFooterPlaceholder {
    display: none;

.listView .header,
.listView .footer {
    height: 80px;
    padding: 10px;
    background-color: #333;

.listView .footer .progress.hide {
    display: none;
} {
  display: none;
} {
  font-family: FontAwesome;
  content: "\f03e";
  color: grey;
  font-size: 64px;
  display: inline-block;
  margin-top: 0em;
  margin-bottom: 0em;
  margin-right: 5px;
              function generateItems(numberOfTimes) {
    var itemArray = [
        { title: "Marvelous Mint", text: "Gelato", picture: "/images/fruits/60Mint.png" },
        { title: "Succulent Strawberry", text: "Sorbet", picture: "/images/fruits/60Strawberry.png" },
        { title: "Banana Blast", text: "Low-fat frozen yogurt", picture: "/images/fruits/60Banana.png" },
        { title: "Lavish Lemon Ice", text: "Sorbet", picture: "/images/fruits/60Lemon.png" },
        { title: "Creamy Orange", text: "Sorbet", picture: "/images/fruits/60Orange.png" },
        { title: "Very Vanilla", text: "Ice Cream", picture: "/images/fruits/60Vanilla.png" },
        { title: "Banana Blast", text: "Low-fat frozen yogurt", picture: "/images/fruits/60Banana.png" },
        { title: "Lavish Lemon Ice", text: "Sorbet", picture: "/images/fruits/60Lemon.png" }

    // Generate items by looping through itemArray by the numberOfTimes given
    var items = [];
    for (var i = 0; i < numberOfTimes; i++) {
        itemArray.forEach(function (item) {

    return items;

// Generate 16 items
var items = generateItems(2);
var data = new WinJS.Binding.List(items);

var groupedData = data.createGrouped(function (item) {
    return item.title.toUpperCase().charAt(0);
}, function (item) {
    return {
        title: item.title.toUpperCase().charAt(0)
}, function (left, right) {
    return left.charCodeAt(0) - right.charCodeAt(0);

WinJS.Namespace.define("Sample.ListView", {
    generate: generateItems,
    data: groupedData,
    eh: {
        footerVisibility: WinJS.UI.eventHandler(function (ev) {
            var visible = ev.detail.visible;
            if (visible) {
                WinJS.Utilities.removeClass(Sample.ListView.progress, "hide");

                // Simulate XHR by just setting a timeout and updating the observable binding list
                WinJS.Promise.timeout(100).then(function () {
                    var items = Sample.ListView.generate(2);
                    items.forEach(function (item) {
            } else {
                WinJS.Utilities.addClass(Sample.ListView.progress, "hide");

// Cache ListView and Header elements
Sample.ListView.listView = document.querySelector(".listView");
Sample.ListView.header = document.querySelector(".header");
Sample.ListView.progress = document.querySelector(".footer .progress");
Sample.ListView.status = document.querySelector(".footer .status");

// Data bind header element and split pane element
WinJS.Binding.processAll(Sample.ListView.header, Sample.ListView).then(function () {
    return WinJS.Binding.processAll(Sample.ListView.splitPane, Sample.ListView);
}).then(function () {
    // Process UI to initialize WinJS controls 
    return WinJS.UI.processAll();

var msToTime = function(duration) {
  var milliseconds = parseInt((duration % 1000)/100);
  var seconds = parseInt((duration / 1000) % 60);
  var minutes = parseInt((duration / (1000*60)) % 60);
  var hours = parseInt((duration / (1000*60*60)) % 24);

  hours = (hours < 10) ? "0" + hours : hours;
  minutes = (minutes < 10) ? "0" + minutes : minutes;
  seconds = (seconds < 10) ? "0" + seconds : seconds;

  return hours + ":" + minutes + ":" + seconds + "." + milliseconds;

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