List Item

Documentation

Input Parameters

Name Type Description
actions string The list item actions.
className string The class name to apply to the main element.
el HTMLElement The element to render the list item to.
isDocument boolean True for document types.
isImage boolean True for image types.
isSelectable boolean True to make the item selectable.
isSelected boolean True to make the item selected.
isUnread boolean True to make the item unread.
isUnseen boolean True to make the item unseen.
metaText string The meta text.
primaryText string The primary text.
secondaryText string The secondary text.
selectionTarget string The selection target.
tertiaryText string The tertiary text.
value string The list item value.

Fabric Interface

Name Type/Description
_container HTMLLIElement
_toggleElement HTMLDivElement

JavaScript

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

// Get the element
var el = document.querySelector("#list");
if(el) {
    // Create the list item elements
    var items = [];
    for(var i=0; i<10; i++) {
        // Create the element
        el.innerHTML += "<div></div>";
    }

    // Create the list items
    var items = [];
    for(var i=0; i<10; i++) {
        // Render an item
        $REST.JS.Fabric.ListItem({
            el: el.children[i],
            primaryText: "Item " + i,
            metaText: i
        }));
    }
}

TypeScript

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

// Get the element
let el = document.querySelector("#list");
if(el) {
    // Create the list item elements
    let items = [];
    for(let i=0; i<10; i++) {
        // Create the element
        el.innerHTML += "<div></div>";
    }

    // Create the list items
    let items = [];
    for(let i=0; i<10; i++) {
        // Render an item
        Fabric.ListItem({
            el: el.children[i],
            primaryText: "Item " + i,
            metaText: i
        }));
    }
}