Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: ui/webui/resources/cr_elements/v0_8/cr_checkbox/cr_checkbox.js

Issue 1105743003: Add a 0.8 version of cr-checkbox with a demo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@polymer08
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 publish: { 20 is: 'cr-checkbox',
21
22 properties: {
21 /** 23 /**
22 * 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.
23 * 25 *
24 * @attribute checked 26 * @attribute checked
25 * @type boolean 27 * @type {boolean}
26 * @default false 28 * @default false
27 */ 29 */
28 checked: {value: false, reflect: true}, 30 checked: {
29 31 type: Boolean,
30 /** 32 value: false,
31 * The label for the checkbox. 33 reflectToAttribute: true
32 * 34 },
33 * @attribute label
34 * @type string
35 * @default ''
36 */
37 label: '',
38 35
39 /** 36 /**
40 * If true, the user cannot interact with this element. 37 * If true, the user cannot interact with this element.
41 * 38 *
42 * @attribute disabled 39 * @attribute disabled
43 * @type boolean 40 * @type {boolean}
44 * @default false 41 * @default false
45 */ 42 */
46 disabled: {value: false, reflect: true}, 43 disabled: {
44 type: Boolean,
45 value: false,
46 reflectToAttribute: true
47 },
47 }, 48 },
48 49
49 toggle: function() { 50 toggle: function() {
50 this.$.checkbox.toggle(); 51 this.$.checkbox.toggle();
51 }, 52 },
52
53 ready: function() {
54 this.$.events.forward(this.$.checkbox, ['change']);
Jeremy Klein 2015/04/24 03:27:42 Got rid of this because it's never actually fired
55 },
56 }); 53 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698