| 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-checkbox` is a button that can be either checked or unchecked. User | 7 * `cr-checkbox` is a button that can be either checked or unchecked. User |
| 8 * can tap the checkbox to check or uncheck it. Usually you use checkboxes | 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 | 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 `cr-toggle-button` | 10 * ON/OFF option, avoid using a single checkbox and use `cr-toggle-button` |
| 11 * instead. | 11 * instead. |
| 12 * | 12 * |
| 13 * Example: | 13 * Example: |
| 14 * <cr-checkbox></cr-checkbox> | 14 * <cr-checkbox></cr-checkbox> |
| 15 * <cr-checkbox checked></cr-checkbox> | 15 * <cr-checkbox checked></cr-checkbox> |
| 16 * | 16 * |
| 17 * @element cr-checkbox | 17 * @element cr-checkbox |
| 18 */ | 18 */ |
| 19 Polymer({ | 19 Polymer({ |
| 20 is: 'cr-checkbox', | 20 is: 'cr-checkbox', |
| 21 | 21 |
| 22 properties: { | 22 properties: { |
| 23 /** | 23 /** |
| 24 * Gets or sets the state. `true` is checked and `false` is unchecked. | 24 * Gets or sets the state. `true` is checked and `false` is unchecked. |
| 25 * | |
| 26 * @attribute checked | |
| 27 * @type {boolean} | |
| 28 * @default false | |
| 29 */ | 25 */ |
| 30 checked: { | 26 checked: { |
| 31 type: Boolean, | 27 type: Boolean, |
| 32 value: false, | 28 value: false, |
| 29 notify: true, |
| 33 reflectToAttribute: true | 30 reflectToAttribute: true |
| 34 }, | 31 }, |
| 35 | 32 |
| 36 /** | 33 /** |
| 37 * If true, the user cannot interact with this element. | 34 * If true, the user cannot interact with this element. |
| 38 * | |
| 39 * @attribute disabled | |
| 40 * @type {boolean} | |
| 41 * @default false | |
| 42 */ | 35 */ |
| 43 disabled: { | 36 disabled: { |
| 44 type: Boolean, | 37 type: Boolean, |
| 45 value: false, | 38 value: false, |
| 46 reflectToAttribute: true | 39 reflectToAttribute: true |
| 47 }, | 40 }, |
| 48 }, | 41 }, |
| 49 | 42 |
| 50 toggle: function() { | 43 toggle: function() { |
| 51 this.$.checkbox.toggle(); | 44 this.$.checkbox.toggle(); |
| 52 }, | 45 }, |
| 53 }); | 46 }); |
| OLD | NEW |