UNPKG

gd-sprest-js

Version:

SharePoint 2013/Online js components.

26 lines (25 loc) 951 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var templates_1 = require("../templates"); /** * Toggle */ exports.Toggle = function (props) { // Set the class name var className = props.className || ""; if (props.disable) { className += " is-disabled"; } // Return the template return [ props.label ? templates_1.Label({ className: "field-label", text: props.label }) : '', '<div class="ms-Toggle ' + className.trim() + '">', props.description ? '<span class="ms-Toggle-description">' + props.description + "</span>" : '', '<input type="checkbox" class="ms-Toggle-input"></input>', '<label class="ms-Toggle-field' + (props.value ? ' is-selected' : '') + '" tabindex="0">', '<span class="ms-Label ms-Label--off">Off</span>', '<span class="ms-Label ms-Label--on">On</span>', '</label>', '</div>' ].join('\n'); };