Suggestion options are passed to the Search constructor as a child of FancySearchOptions. These options control the look and behavior of the dropdown suggestion list.

Properties

suggestions:Null<Array<T>>

This array of suggestion items can be any type. The type provided here sets the type for everything else. Strings would be a common choice, but anything you can filter and represent as a string will work.

By default, this is an empty array.

suggestionToString:Null<T ‑> String>

While your suggestions can by any type, we need to convert them to strings to render in the DOM list of dropdown suggestions. The default function calls Std.string() on the item.

If you provide a suggestion list of simple types such as numbers or strings, the default is fine. For complex types, you'll want to override this.

sortSuggestionsFn:Null<SortSuggestions<T>>

Optionally override the default SortSuggestions function

showSearchLiteralItem:Null<Bool>

Whether to show the literal "Search for: ..." string. Default: false

searchLiteralValue:Null<InputElement ‑> String>

Function to convert the input's value to a literal string to follow the "Search for:" prefix. By default, this just returns the input's value.

searchLiteralPrefix:Null<String>

String preceding the literal input string. Default: "Search for: "

searchLiteralPosition:Null<LiteralPosition>

Position of the literal "Search for: ..." suggestion. Default: First

onChooseSelection:Null<SelectionChooseFunction<T>>

Optionally override the default selectionChooseFunction

limit:Null<Int>

The maximum number of suggestions to be show. Default 5

highlightLettersFn:Null<HighlightLetters<T>>

Optionally override the default HighlightLetters function

filterFn:Null<FilterFunction<T>>

Optionally override the default FilterFunction