PolymerElements/iron-selector

Name: iron-selector

Owner: PolymerElements

Description: Manages a list of elements that can be selected

Created: 2015-04-16 20:39:35.0

Updated: 2018-05-14 23:45:28.0

Pushed: 2018-05-23 02:32:51.0

Homepage: null

Size: 380

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build status Published on webcomponents.org

Demo and API docs

<iron-selector>

iron-selector is an element which can be used to manage a list of elements that can be selected. Tapping on the item will make the item selected. The selected indicates which item is being selected. The default is to use the index of the item.

Example:

ron-selector selected="0">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
iron-selector>

If you want to use the attribute value of an element for selected instead of the index, set attrForSelected to the name of the attribute. For example, if you want to select item by name, set attrForSelected to name.

Example:

ron-selector attr-for-selected="name" selected="foo">
<div name="foo">Foo</div>
<div name="bar">Bar</div>
<div name="zot">Zot</div>
iron-selector>

You can specify a default fallback with fallbackSelection in case the selected attribute does not match the attrForSelected attribute of any elements.

Example:

<iron-selector attr-for-selected="name" selected="non-existing"
               fallback-selection="default">
  <div name="foo">Foo</div>
  <div name="bar">Bar</div>
  <div name="default">Default</div>
</iron-selector>

Note: When the selector is multi, the selection will set to fallbackSelection iff the number of matching elements is zero.

iron-selector is not styled. Use the iron-selected CSS class to style the selected element.

Example:

tyle>
.iron-selected {
  background: #eee;
}
style>

.

ron-selector selected="0">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
iron-selector>
Notable breaking changes between 1.x and 2.x (hybrid):
IronSelectableBehavior IronMultiSelectableBehavior

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.