List

Documentation

Input Parameters

Name Type Description
className string The class name to apply to the main element.
el HTMLElement The element to render the list to.
items Array<IListItemProps> The list items.
onClick (ev: MouseEvent) The item click event.

Fabric Interface

Name Type/Description
_container HTMLUListElement
_listItemComponents Array

JavaScript

var $REST = require("gd-sprest-js");

// Create the list items
var items = [];
for(var i=0; i<10; i++) {
    // Add an item
    items.push({
        primaryText: "Item " + i,
        metaText: i
    });
}

// Create the list
var el = document.querySelector("#list");
$REST.JS.Fabric.List({
    el: el,
    items: items
});

TypeScript

import { Fabric } from "gd-sprest-js";

// Create the list items
let items: Array<Fabric.Types.IListItemProps> = [];
for(let i=0; i<10; i++) {
    // Add an item
    items.push({
        primaryText: "Item " + i,
        metaText: i
    });
}

// Create the list
let el = document.querySelector("#list");
Fabric.List({
    el: el,
    items: items
});