OLD | NEW |
1 iron-iconset | 1 iron-iconset |
2 ============ | 2 ============ |
3 | 3 |
4 See the [component page](http://polymer-project.org/docs/elements/iron-elements.
html#iron-iconset) for more information. | 4 The `iron-iconset` element allows users to define their own icon sets. |
| 5 The `src` property specifies the url of the icon image. Multiple icons may |
| 6 be included in this image and they may be organized into rows. |
| 7 The `icons` property is a space separated list of names corresponding to the |
| 8 icons. The names must be ordered as the icons are ordered in the icon image. |
| 9 Icons are expected to be square and are the size specified by the `size` |
| 10 property. The `width` property corresponds to the width of the icon image |
| 11 and must be specified if icons are arranged into multiple rows in the image. |
| 12 |
| 13 All `iron-iconset` elements are available for use by other `iron-iconset` |
| 14 elements via a database keyed by id. Typically, an element author that wants |
| 15 to support a set of custom icons uses a `iron-iconset` to retrieve |
| 16 and use another, user-defined iconset. |
| 17 |
| 18 Example: |
| 19 |
| 20 ```html |
| 21 <iron-iconset id="my-icons" src="my-icons.png" width="96" size="24" |
| 22 icons="location place starta stopb bus car train walk"> |
| 23 </iron-iconset> |
| 24 ``` |
| 25 |
| 26 This will automatically register the icon set "my-icons" to the iconset |
| 27 database. To use these icons from within another element, make a |
| 28 `iron-iconset` element and call the `byId` method to retrieve a |
| 29 given iconset. To apply a particular icon to an element, use the |
| 30 `applyIcon` method. For example: |
| 31 |
| 32 ```javascript |
| 33 iconset.applyIcon(iconNode, 'car'); |
| 34 ``` |
| 35 |
| 36 Themed icon sets are also supported. The `iron-iconset` can contain child |
| 37 `property` elements that specify a theme with an offsetX and offsetY of the |
| 38 theme within the icon resource. For example. |
| 39 |
| 40 ```html |
| 41 <iron-iconset id="my-icons" src="my-icons.png" width="96" size="24" |
| 42 icons="location place starta stopb bus car train walk"> |
| 43 <property theme="special" offsetX="256" offsetY="24"></property> |
| 44 </iron-iconset> |
| 45 ``` |
| 46 |
| 47 Then a themed icon can be applied like this: |
| 48 |
| 49 ```javascript |
| 50 iconset.applyIcon(iconNode, 'car', 'special'); |
| 51 ``` |
OLD | NEW |