EvoToolkit - v3.7.2 (Changelog)

Fuzzy Search

Fuzzy search variant of the input component. Uses a simplified version of the Levenshtein distance string metric to generate matches.

Related Readings

Source

Contributors

Luke Harrison
  • Overview
  • Options
  • Methods
  • Theming

Base

Standard

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.

No Free Typing

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.

JavaScript

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 data-input-fuzzy-disable-highlight attribute.

Default
Example
Example

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.

setData

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

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