README.md
1
2<!---
3
4This README is automatically generated from the comments in these files:
5paper-icon-item.html paper-item-behavior.html paper-item-body.html paper-item.html
6
7Edit those files, and our readme bot will duplicate them over here!
8Edit this file, and the bot will squash your changes :)
9
10The bot does some handling of markdown. Please file a bug if it does the wrong
11thing! https://github.com/PolymerLabs/tedium/issues
12
13-->
14
15[![Build status](https://travis-ci.org/PolymerElements/paper-item.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-item)
16
17_[Demo and API docs](https://elements.polymer-project.org/elements/paper-item)_
18
19
20##<paper-item>
21
22Material design: [Lists](https://www.google.com/design/spec/components/lists.html)
23
24`<paper-item>` is an interactive list item. By default, it is a horizontal flexbox.
25
26```html
27<paper-item>Item</paper-item>
28```
29
30Use this element with `<paper-item-body>` to make Material Design styled two-line and three-line
31items.
32
33```html
34<paper-item>
35 <paper-item-body two-line>
36 <div>Show your status</div>
37 <div secondary>Your status is visible to everyone</div>
38 </paper-item-body>
39 <iron-icon icon="warning"></iron-icon>
40</paper-item>
41```
42
43To use `paper-item` as a link, wrap it in an anchor tag. Since `paper-item` will
44already receive focus, you may want to prevent the anchor tag from receiving
45focus as well by setting its tabindex to -1.
46
47```html
48<a href="https://www.polymer-project.org/" tabindex="-1">
49 <paper-item raised>Polymer Project</paper-item>
50</a>
51```
52
53If you are concerned about performance and want to use `paper-item` in a `paper-listbox`
54with many items, you can just use a native `button` with the `paper-item` class
55applied (provided you have correctly included the shared styles):
56
57```html
58<style is="custom-style" include="paper-item-shared-styles"></style>
59
60<paper-listbox>
61 <button class="paper-item" role="option">Inbox</button>
62 <button class="paper-item" role="option">Starred</button>
63 <button class="paper-item" role="option">Sent mail</button>
64</paper-listbox>
65```
66
67### Styling
68
69The following custom properties and mixins are available for styling:
70
71| Custom property | Description | Default |
72| --- | --- | --- |
73| `--paper-item-min-height` | Minimum height of the item | `48px` |
74| `--paper-item` | Mixin applied to the item | `{}` |
75| `--paper-item-selected-weight` | The font weight of a selected item | `bold` |
76| `--paper-item-selected` | Mixin applied to selected paper-items | `{}` |
77| `--paper-item-disabled-color` | The color for disabled paper-items | `--disabled-text-color` |
78| `--paper-item-disabled` | Mixin applied to disabled paper-items | `{}` |
79| `--paper-item-focused` | Mixin applied to focused paper-items | `{}` |
80| `--paper-item-focused-before` | Mixin applied to :before focused paper-items | `{}` |
81
82### Accessibility
83
84This element has `role="listitem"` by default. Depending on usage, it may be more appropriate to set
85`role="menuitem"`, `role="menuitemcheckbox"` or `role="menuitemradio"`.
86
87```html
88<paper-item role="menuitemcheckbox">
89 <paper-item-body>
90 Show your status
91 </paper-item-body>
92 <paper-checkbox></paper-checkbox>
93</paper-item>
94```
95
96
97
98##<paper-icon-item>
99
100`<paper-icon-item>` is a convenience element to make an item with icon. It is an interactive list
101item with a fixed-width icon area, according to Material Design. This is useful if the icons are of
102varying widths, but you want the item bodies to line up. Use this like a `<paper-item>`. The child
103node with the attribute `item-icon` is placed in the icon area.
104
105```html
106<paper-icon-item>
107 <iron-icon icon="favorite" item-icon></iron-icon>
108 Favorite
109</paper-icon-item>
110<paper-icon-item>
111 <div class="avatar" item-icon></div>
112 Avatar
113</paper-icon-item>
114```
115
116### Styling
117
118The following custom properties and mixins are available for styling:
119
120| Custom property | Description | Default |
121| --- | --- | --- |
122| `--paper-item-icon-width` | Width of the icon area | `56px` |
123| `--paper-item-icon` | Mixin applied to the icon area | `{}` |
124| `--paper-icon-item` | Mixin applied to the item | `{}` |
125| `--paper-item-selected-weight` | The font weight of a selected item | `bold` |
126| `--paper-item-selected` | Mixin applied to selected paper-items | `{}` |
127| `--paper-item-disabled-color` | The color for disabled paper-items | `--disabled-text-color` |
128| `--paper-item-disabled` | Mixin applied to disabled paper-items | `{}` |
129| `--paper-item-focused` | Mixin applied to focused paper-items | `{}` |
130| `--paper-item-focused-before` | Mixin applied to :before focused paper-items | `{}` |
131
132
133
134##<paper-item-body>
135
136Use `<paper-item-body>` in a `<paper-item>` or `<paper-icon-item>` to make two- or
137three- line items. It is a flex item that is a vertical flexbox.
138
139```html
140<paper-item>
141 <paper-item-body two-line>
142 <div>Show your status</div>
143 <div secondary>Your status is visible to everyone</div>
144 </paper-item-body>
145</paper-item>
146```
147
148The child elements with the `secondary` attribute is given secondary text styling.
149
150### Styling
151
152The following custom properties and mixins are available for styling:
153
154| Custom property | Description | Default |
155| --- | --- | --- |
156| `--paper-item-body-two-line-min-height` | Minimum height of a two-line item | `72px` |
157| `--paper-item-body-three-line-min-height` | Minimum height of a three-line item | `88px` |
158| `--paper-item-body-secondary-color` | Foreground color for the `secondary` area | `--secondary-text-color` |
159| `--paper-item-body-secondary` | Mixin applied to the `secondary` area | `{}` |
160
161
162
163<!-- No docs for Polymer.PaperItemBehavior found. -->
164