UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

24 lines 1.95 kB
import * as tslib_1 from "tslib"; // @codepen import * as React from 'react'; import { Toggle } from 'office-ui-fabric-react/lib/Toggle'; var ToggleBasicExample = /** @class */ (function (_super) { tslib_1.__extends(ToggleBasicExample, _super); function ToggleBasicExample() { return _super !== null && _super.apply(this, arguments) || this; } ToggleBasicExample.prototype.render = function () { // tslint:disable:jsx-no-lambda return (React.createElement("div", { style: { padding: '2px' } }, React.createElement(Toggle, { defaultChecked: true, label: "Enabled and checked", onText: "On", offText: "Off", onFocus: function () { return console.log('onFocus called'); }, onBlur: function () { return console.log('onBlur called'); }, onChange: this._onChange }), React.createElement(Toggle, { defaultChecked: false, label: "Enabled and unchecked", onText: "On", offText: "Off", onFocus: function () { return console.log('onFocus called'); }, onBlur: function () { return console.log('onBlur called'); }, onChange: this._onChange }), React.createElement(Toggle, { defaultChecked: true, disabled: true, label: "Disabled and checked", onText: "On", offText: "Off", onFocus: function () { return console.log('onFocus called'); }, onBlur: function () { return console.log('onBlur called'); } }), React.createElement(Toggle, { defaultChecked: false, disabled: true, label: "Disabled and unchecked", onText: "On", offText: "Off", onFocus: function () { return console.log('onFocus called'); }, onBlur: function () { return console.log('onBlur called'); } }))); }; ToggleBasicExample.prototype._onChange = function (ev, checked) { console.log('toggle is ' + (checked ? 'checked' : 'not checked')); }; return ToggleBasicExample; }(React.Component)); export { ToggleBasicExample }; //# sourceMappingURL=Toggle.Basic.Example.js.map