You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`filter-input[aria-owns]` should point to the container ID that wraps all `<filter-input>` related elements.
37
+
-`filter-input` should have one `input` child element that is used to filter.
38
+
-`[id]` should be set on a container that either contains or has `[data-filter-list]` attribute.
39
+
-`[data-filter-list]` should be set on the element whose **direct child elements** are to be filtered.
40
+
41
+
### Optional
42
+
43
+
#### Specify filter text
44
+
45
+
Use `[data-filter-item-text]` to specify an element whose text should be used for filtering. In the following example, the text `(current)` would not be matched.
46
+
47
+
```html
48
+
<divdata-filter-list>
49
+
<ahref="/bender">Bender</a>
50
+
<ahref="/hubot">
51
+
<spandata-filter-item-text>Hubot</span>
52
+
(current)
53
+
</a>
54
+
</div>
55
+
```
56
+
57
+
#### Blankslate
58
+
59
+
Use `[data-filter-empty-state]` to specify an element to be displayed when no results were found. This element must be inside of the container `aria-owns` points to.
Use `[data-filter-new-item]` to include an item to create a new instance when no exact match were found. The element with `[data-filter-new-text]`'s text content will be set to the input value. You can also use `[data-filter-new-value]` to set an input value to the query param.
74
+
75
+
```html
76
+
<divid="filter-list">
77
+
<divdata-filter-list>
78
+
<ahref="/bender">Bender</a>
79
+
<ahref="/hubot">Hubot</a>
80
+
</div>
81
+
<ahref="/new"data-filter-new-itemhidden>
82
+
Create new robot named "<spandata-filter-new-item-text></span>"
83
+
</a>
84
+
</div>
85
+
```
86
+
87
+
## Methods
88
+
89
+
`filterInputElement.filter` can be optionally set to provide an alternative filtering logic. The default is substring.
-`filter-input-start` (bubbles) - fired on `<filter-input>` when a filter action is about to start.
102
+
-`filter-input-updated` (bubbles) - fired on `<filter-input>` when filter has finished. `event.detail.count` is the number of matches found, and `event.detail.total` is the total number of elements.
103
+
36
104
## Browser support
37
105
38
106
Browsers without native [custom element support][support] require a [polyfill][].
0 commit comments