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
feat(clearOnSelected): allow users to clear the input instead of filling (#244)
* feat(clearOnSelected): allow users to clear the input instead of filling
In some use-cases, like when you're using autocomplete to make tags on a page, or using the output in any other way than prefilling the query, you don't want the suggested value to show in the input, but would rather like it to be empty.
Before this PR it was basically impossible to have your input not filled, since it came back on blur and a few different places (see `resetInputValue`
fixes#241
* fix: make sure both query and input are ''
* chore: update test
* chore: test implem of callback too
* chore: more specific test
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -290,6 +290,8 @@ When initializing an autocomplete, there are a number of options you can configu
290
290
291
291
*`debug` – If `true`, the autocomplete will not close on `blur`. Defaults to `false`.
292
292
293
+
*`clearOnSelected` – If `true`, the autocomplete will empty the search box when a suggestion is selected. This is useful if you want to use this as a way to input tags using the `selected` event.
294
+
293
295
*`openOnFocus` – If `true`, the dropdown menu will open when the input is focused. Defaults to `false`.
294
296
295
297
*`appendTo` – If set with a DOM selector, doesn't wrap the input and appends the wrapper and dropdown menu to the first DOM element matching the selector. It automatically positions the wrapper under the input, and sets it to the same width as the input. Can't be used with `hint: true`, because `hint` requires the wrapper around the input.
0 commit comments