Fuzzy search variant of the input component. Uses a simplified version of the Levenshtein distance string metric to generate matches.
Allows you to free type an input value, and the dropdown provides matches which you may or may not decide to select.
When a value is selected, in addition to the input, it also appears in the data-value
data attribute on the top level block component.
Only allows you to select values which are present in the fuzzy search dropdown.
You can modify the fuzzy search component by overriding certain JavaScript functionality through HTML data-attributes.
You can modify fuzzy search component functionality by adding the below data attribute. Unless stated otherwise, these must be placed on the top level block component (eg:- c-calendar
)
Name | |
---|---|
Name |
data-input-fuzzy-disable-highlight
|
Description | |
Description |
Disable the highlight over matches by adding the |
Default | |
Example | |
Example |
Search for your favourite Premier League football teams or free type your own.
|
This component has methods which allow you to programatically trigger actions. You can trigger these using the evo()
selector.
See JavaScript API for more information and a list of shared, global methods.
You can pass an array
or key/value object
directly to the fuzzy search to use as a data source, or you can pass it an API endpoint and it'll grab it from there.
evo('.js-fuzzy').inputFuzzySearch('setData', {
source: [
'foo',
'bar'
]
})
evo('.js-fuzzy').inputFuzzySearch('setData', {
source: {
foo: 'bar'
}
})
evo('.js-fuzzy').inputFuzzySearch('setData', {
source: 'https://www.my-api-end-point.com'
})
You can theme the fuzzy search component to make it fit your brand. For more information on theming EvoToolkit, please see Configuring EvoToolkit.
Below is a list of theme variables and their default values.
Theme Variables | Default |
---|---|
$component-input-focus-color |
primary |
$component-input-border-color |
light |
$component-input-disabled-background-color |
very-light |
$component-input-box-color |
very-light |
$component-input-disabled-text-color |
light |
$component-input-calendar-box-border-color |
primary |