Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright 2015 The Chromium Authors. All rights reserved. | 1 /* Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. */ | 3 * found in the LICENSE file. */ |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * `cr-toggle-button` provides a switch the user can toggle on or off by | 7 * `paper-checkbox` is a button that can be either checked or unchecked. User |
|
michaelpg
2015/02/11 02:08:10
cr-checkbox, cr-toggle-button, etc
Oren Blasberg
2015/02/11 20:12:42
Done.
| |
| 8 * tapping or by dragging. Wraps a `paper-toggle-button`. | 8 * can tap the checkbox to check or uncheck it. Usually you use checkboxes |
| 9 * to allow user to select multiple options from a set. If you have a single | |
| 10 * ON/OFF option, avoid using a single checkbox and use `paper-toggle-button` | |
| 11 * instead. | |
| 9 * | 12 * |
| 10 * Example: | 13 * Example: |
| 14 * <paper-checkbox></paper-checkbox> | |
|
Jeremy Klein
2015/02/11 01:55:36
cr-checkbox
Oren Blasberg
2015/02/11 20:12:42
Done.
| |
| 15 * <paper-checkbox checked></paper-checkbox> | |
| 11 * | 16 * |
| 12 * <cr-toggle-button></cr-toggle-button> | 17 * @element cr-checkbox |
| 13 * | |
| 14 * @element cr-toggle-button | |
| 15 */ | 18 */ |
| 16 Polymer({ | 19 Polymer({ |
|
Jeremy Klein
2015/02/11 01:55:36
Should we also expose the toggle function?
Oren Blasberg
2015/02/11 20:12:42
Done.
| |
| 17 publish: { | 20 publish: { |
| 18 /** | 21 /** |
| 19 * Gets or sets the state. `true` is checked and `false` is unchecked. | 22 * Gets or sets the state. `true` is checked and `false` is unchecked. |
| 20 * | 23 * |
| 21 * @attribute checked | 24 * @attribute checked |
| 22 * @type boolean | 25 * @type boolean |
| 23 * @default false | 26 * @default false |
| 24 */ | 27 */ |
| 25 checked: { | 28 checked: { |
| 26 value: false, | 29 value: false, |
| 27 reflect: true, | 30 reflect: true, |
| 28 }, | 31 }, |
| 29 | 32 |
| 30 | 33 |
| 31 /** | 34 /** |
| 35 * The label for the checkbox. | |
| 36 * | |
| 37 * @attribute label | |
| 38 * @type string | |
| 39 * @default '' | |
| 40 */ | |
| 41 label: '', | |
| 42 | |
| 43 | |
| 44 /** | |
| 32 * If true, the toggle button is disabled. | 45 * If true, the toggle button is disabled. |
| 33 * | 46 * |
| 34 * @attribute disabled | 47 * @attribute disabled |
| 35 * @type boolean | 48 * @type boolean |
| 36 * @default false | 49 * @default false |
| 37 */ | 50 */ |
| 38 disabled: { | 51 disabled: { |
| 39 value: false, | 52 value: false, |
| 40 reflect: true, | 53 reflect: true, |
| 41 }, | 54 }, |
| 42 }, | 55 }, |
| 43 | 56 |
| 44 ready: function() { | 57 ready: function() { |
| 45 this.$.events.forward(this.$.button, ['change']); | 58 this.$.events.forward(this.$.button, ['change']); |
| 46 }, | 59 }, |
| 47 }); | 60 }); |
| OLD | NEW |