Skip to content

Commit 0251e8d

Browse files
committed
Clarify the use case for hideNew and create new item
1 parent cd9a2ec commit 0251e8d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Use `[data-filter-empty-state]` to specify an element to be displayed when no re
6868
</div>
6969
```
7070

71-
#### Create new actions
71+
#### Create new item
7272

7373
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.
7474

@@ -78,9 +78,11 @@ Use `[data-filter-new-item]` to include an item to create a new instance when no
7878
<a href="/bender">Bender</a>
7979
<a href="/hubot">Hubot</a>
8080
</div>
81-
<a href="/new" data-filter-new-item hidden>
82-
Create new robot named "<span data-filter-new-item-text></span>"
83-
</a>
81+
<form action="/new" data-filter-new-item hidden>
82+
<button name="robot" data-filter-new-item-value>
83+
Create robot "<span data-filter-new-item-text></span>"
84+
</button>
85+
</form>
8486
</div>
8587
```
8688

@@ -96,6 +98,8 @@ fuzzyFilterInput.filter = (element, elementText, query) => {
9698
}
9799
```
98100

101+
`match`(required) indicates whether the item should be shown. `hideNew` (optional) will determine whether the "Create new item" element should be hidden. For example, when an exact match is found, the "create new item" option should be hidden.
102+
99103
## Events
100104

101105
- `filter-input-start` (bubbles) - fired on `<filter-input>` when a filter action is about to start.

0 commit comments

Comments
 (0)