Polymer elements added to third_party/polymer.
[chromium-blink-merge.git] / third_party / polymer / components / paper-item / paper-item.html
blobceb1b8aeca4ae6197be35706bebc7a4807482128
1 <!--
2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
8 -->
10 <!--
11 @group Paper Elements
13 `paper-item` is a list-item object for use in menus. It may contain and icon and/or
14 a text label.
16 Example:
18 <core-menu>
19 <paper-item icon="refresh" label="Refresh"></paper-item>
20 <paper-item label="Help"></paper-item>
21 <paper-item label="Sign Out"></paper-item>
22 </core-menu>
24 To use as a link, put an `&lt;a&gt;` element in the item.
26 Example:
28 <paper-item icon="home" label="Home">
29 <a href="http://www.polymer-project.org"></a>
30 </paper-item>
32 @class paper-item
33 -->
35 <link href="../polymer/polymer.html" rel="import">
36 <link href="../core-icon/core-icon.html" rel="import">
37 <link href="../paper-ripple/paper-ripple.html" rel="import">
39 <link href="paper-item.css" rel="stylesheet" shim-shadowdom>
41 <polymer-element name="paper-item" attributes="label iconSrc icon" center horizontal layout>
43 <template>
45 <paper-ripple id="ripple"></paper-ripple>
47 <core-icon id="icon" hidden?="{{!iconSrc && !icon}}" src="{{iconSrc}}" icon="{{icon}}"></core-icon>
48 <div id="label">{{label}}</div>
49 <content></content>
50 </template>
52 <script>
53 Polymer('paper-item', {
55 publish: {
57 /**
58 * The label for the item.
60 * @attribute label
61 * @type string
62 * @default ''
64 label: '',
66 /**
67 * (optional) The URL of an image for an icon to use in the button.
68 * Should not use `icon` property if you are using this property.
70 * @attribute iconSrc
71 * @type string
72 * @default ''
74 iconSrc: '',
76 /**
77 * (optional) Specifies the icon name or index in the set of icons
78 * available in the icon set. If using this property, load the icon
79 * set separately where the icon is used. Should not use `src`
80 * if you are using this property.
82 * @attribute icon
83 * @type string
84 * @default ''
86 icon: ''
90 eventDelegates: {
91 'down': 'downAction',
92 'up': 'upAction'
95 downAction: function(e) {
96 this.$.ripple.downAction(e);
99 upAction: function(e) {
100 this.$.ripple.upAction(e);
103 </script>
104 </polymer-element>