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
10 @group Polymer Core Elements
12 The `<core-selection>` element is used to manage selection state. It has no
13 visual appearance and is typically used in conjunction with another element.
14 For example, [core-selector](#core-selector)
15 use a `<core-selection>` to manage selection.
17 To mark an item as selected, call the `select(item)` method on
18 `<core-selection>`. The item itself is an argument to this method.
20 The `<core-selection>`element manages selection state for any given set of
21 items. When an item is selected, the `core-select` event is fired.
23 The attribute `multi` indicates if multiple items can be selected at once.
27 <polymer-element name="selection-example">
30 polyfill-next-selector { content: ':host > .selected'; }
31 ::content > .selected {
36 <ul on-tap="{{itemTapAction}}">
39 <core-selection id="selection" multi
40 on-core-select="{{selectAction}}"></core-selection>
43 Polymer('selection-example', {
44 itemTapAction: function(e, detail, sender) {
45 this.$.selection.select(e.target);
47 selectAction: function(e, detail, sender) {
48 detail.item.classList.toggle('selected', detail.isSelected);
60 @element core-selection
64 Fired when an item's selection state is changed. This event is fired both
65 when an item is selected or deselected. The `isSelected` detail property
66 contains the selection state.
69 @param {Object} detail
70 @param {boolean} detail.isSelected true for selection and false for de-selection
71 @param {Object} detail.item the item element
73 <link rel="import" href="../polymer/polymer.html">
75 <polymer-element name="core-selection" attributes="multi" hidden assetpath="">
78 <script src="core-selection-extracted.js"></script>