Accessible, fuzzy search typeahead component
Features
value
to the default slot propsBreaking Changes
.svelte.d.ts
for the component TypeScript definition extensionBreaking Changes
ul
element is rendered even without results to preserve the accessibility labelFixes
svelte-search
aria-activedescendant
item to svelte-search
Contributed by @Skovvart in #20
Fixes
id
to Search
to fix aria-labelledby
references (contributed by @Skovvart in #19 )Features
add limit
prop to limit number of results; default value is Infinity
<Typeahead limit={2} {data} {extract} />
Features
disable
, filter
props to disable and filter items from the result set (contributed by @Amerlander)Fixes
Features
add inputAfterSelect
prop to allow user to preserve or clear the input field after selecting a result; possible values are "update" | "clear" | "keep"
(default is "update"
)
add searched value to dispatched "select" event detail (e.detail.searched
)
<Typeahead
inputAfterSelect="clear"
on:select="{(e) => {
console.log(e.detail.searched);
}}"
/>
Features
include original
item and originalIndex
in dispatched "select" event
<Typeahead
on:select="{(e) => {
console.log(e.detail.original);
console.log(e.detail.originalIndex);
}}"
/>
Breaking Changes
svelte-search
to version 1.0.0label
, placeholder
props from search-svelte
SvelteComponentTyped
interface in TypeScript definitionsFeatures
results
array containing fuzzy resultsfocusAfterSelect
to opt in to focusing input after selecting a resultBreaking changes
focusAfterSelect
is false
by default