Chromium Code Reviews| Index: ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js |
| diff --git a/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js b/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..730f8d8a80c04244ce72cf65dcff84a0805e9402 |
| --- /dev/null |
| +++ b/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview |
| + * 'cr-expand-button' is a chrome-specific wrapper around paper-button that |
| + * toggles between an opened (expanded) and closed state. |
| + * |
| + * Example: |
| + * |
| + * <cr-expand-button expanded={{sectionIsExpanded}}></cr-expand-button> |
|
michaelpg
2015/04/23 02:16:29
nit: need "" around the {{}} in the example
stevenjb
2015/04/24 01:25:26
Done.
|
| + * |
| + * @group Chrome Elements |
| + * @element cr-expand-button |
| + */ |
| +Polymer('cr-expand-button', { |
| + publish: { |
| + /** |
| + * If true, the button is in the expanded state and will show the |
| + * 'expand-less' icon. If false, the button shows the 'expand-more' icon. |
| + * |
| + * @attribute expanded |
| + * @type boolean |
| + * @default false |
| + */ |
| + expanded: false, |
| + |
| + /** |
| + * If true, the button will be disabled and greyed out. |
| + * |
| + * @attribute disabled |
| + * @type boolean |
| + * @default false |
| + */ |
| + disabled: {value: false, reflect: true}, |
| + }, |
| + |
| + /** |
| + * Event triggered when the expand button is clicked. Updates the expand |
| + * property. |
| + */ |
| + toggleExpanded: function() { |
| + this.expanded = !this.expanded; |
| + }, |
| +}); |