OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright 2013 The Polymer Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style |
| 4 license that can be found in the LICENSE file. |
| 5 --> |
| 6 <!-- |
| 7 /** |
| 8 * @module Polymer UI Elements |
| 9 */ |
| 10 /** |
| 11 * polymer-ui-icon-button enables you to place an image centered in a button. |
| 12 * |
| 13 * Example: |
| 14 * |
| 15 * <polymer-ui-icon-button src="star.png"></polymer-ui-icon-button> |
| 16 * |
| 17 * Polymer includes an icon set. The property "icon" can be used |
| 18 * to specify which icon to use. |
| 19 * |
| 20 * Example: |
| 21 * |
| 22 * <polymer-ui-icon-button icon="menu"></polymer-ui-icon-button> |
| 23 * |
| 24 * @class polymer-ui-icon-button |
| 25 */ |
| 26 --> |
| 27 <link rel="import" href="../polymer/polymer.html"> |
| 28 <link rel="import" href="../polymer-ui-icon/polymer-ui-icon.html"> |
| 29 |
| 30 <polymer-element name="polymer-ui-icon-button" extends="polymer-ui-theme-aware"
attributes="src index icon active"> |
| 31 <template> |
| 32 <link rel="stylesheet" href="polymer-ui-icon-button.css"> |
| 33 <polymer-ui-icon src="{{src}}" index="{{index}}" icon="{{icon}}"><content></
content></polymer-ui-icon> |
| 34 </template> |
| 35 <script> |
| 36 Polymer('polymer-ui-icon-button', { |
| 37 /** |
| 38 * The URL of an image for the icon. |
| 39 * |
| 40 * @attribute src |
| 41 * @type string |
| 42 * @default '' |
| 43 */ |
| 44 src: '', |
| 45 /** |
| 46 * If true, border is placed around the button to indicate |
| 47 * active state. |
| 48 * |
| 49 * @attribute active |
| 50 * @type boolean |
| 51 * @default false |
| 52 */ |
| 53 active: false, |
| 54 /** |
| 55 * Specifies the icon from the Polymer icon set. |
| 56 * |
| 57 * @attribute icon |
| 58 * @type string |
| 59 * @default '' |
| 60 */ |
| 61 icon: '', |
| 62 /** |
| 63 * If a theme is applied that includes an icon set, the index of the |
| 64 * icon to display. |
| 65 * |
| 66 * @attribute index |
| 67 * @type number |
| 68 * @default -1 |
| 69 */ |
| 70 index: -1, |
| 71 activeChanged: function() { |
| 72 // TODO(sjmiles): sugar this common case |
| 73 this.classList.toggle('selected', this.active); |
| 74 } |
| 75 }); |
| 76 </script> |
| 77 </polymer-element> |
OLD | NEW |