3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 --><html><head><link rel=
"import" href=
"../polymer/polymer.html">
10 <link rel=
"import" href=
"../iron-resizable-behavior/iron-resizable-behavior.html">
14 `iron-list` displays a virtual, 'infinite' list. The template inside
15 the iron-list element represents the DOM to create for each list item.
16 The `items` property specifies an array of list item data.
18 For performance reasons, not every item in the list is rendered at once;
19 instead a small subset of actual template elements *(enough to fill the viewport)*
20 are rendered and reused as the user scrolls. As such, it is important that all
21 state of the list template be bound to the model driving it, since the view may
22 be reused with a new model at any time. Particularly, any state that may change
23 as the result of a user interaction with the list item must be bound to the model
24 to avoid view state inconsistency.
26 __Important:__ `iron-list` must ether be explicitly sized, or delegate scrolling to an
27 explicitly sized parent. By "explicitly sized", we mean it either has an explicit
28 CSS `height` property set via a class or inline style, or else is sized by other
29 layout means (e.g. the `flex` or `fit` classes).
33 List item templates should bind to template models of the following structure:
36 index: 0, // data index for this item
37 item: { // user data corresponding to items[index]
42 Alternatively, you can change the property name used as data index by changing the
43 `indexAs` property. The `as` property defines the name of the variable to add to the binding
46 For example, given the following `data` array:
56 The following code would render the list (note the name and checked properties are
57 bound from the model object provided to the template scope):
59 <template is="dom-bind">
60 <iron-ajax url="data.json" last-response="{{data}}" auto></iron-ajax>
61 <iron-list items="[[data]]" as="item">
64 Name: <span>[[item.name]]</span>
72 `iron-list` lays out the items when it recives a notification via the `resize` event.
73 This event is fired by any element that implements `IronResizableBehavior`.
75 By default, elements such as `iron-pages`, `paper-tabs` or `paper-dialog` will trigger
76 this event automatically. If you hide the list manually (e.g. you use `display: none`)
77 you might want to implement `IronResizableBehavior` or fire this event manually right
78 after the list became visible again. e.g.
80 document.querySelector('iron-list').fire('resize');
88 </head><body><dom-module id=
"iron-list">
95 :host(.has-scroller) {
99 :host(:not(.has-scroller)) {
107 #items
> ::content
> * {
109 box-sizing: border-box;
112 will-change: transform;
118 <array-selector id=
"selector" items=
"{{items}}" selected=
"{{selectedItems}}" selected-item=
"{{selectedItem}}">
128 <script src=
"iron-list-extracted.js"></script></body></html>