Text Input
Creates a text input that can be used to filter or search
To see how to filter a query using a text input, see Filters.
Selected:
<TextInput
name=name_of_input
title="Search"
/>
Selected: {inputs.text_input_name}
Examples
Basic Text Input
Selected:
<TextInput
name=name_of_input
/>
Selected: {inputs.name_of_input}
With Title
Selected:
<TextInput
name=name_of_input
title="Search"
/>
Selected: {inputs.text_input2}
With Placeholder
Selected:
<TextInput
name=name_of_input
title="Freetext Search"
placeholder="Start typing"
/>
Selected: {inputs.text_input3}
With Default Text Prefilled
Selected: Sporting
<TextInput
name=name_of_input
title="Default Selected"
defaultValue="Sporting"
/>
Selected: {inputs.text_input4}
Fuzzy Finding (Searching)
TextInput
provides an easy-to-use shortcut for fuzzy finding. Note that this is different than LIKE
, as it does not require a direct substring, and is useful in situtations where spelling may be unknown, like names.
You can reference it by using the syntax {inputs.your_input_name.search('column_name')}
, and it returns a number between 0 and 1.
Usage
Assuming you had some TextInput first_name_search
:
SELECT * FROM users
ORDER BY {inputs.first_name_search.search('first_name')}
LIMIT 10 -- Optionally limit to only show the 10 closest results
becomes
SELECT * FROM users
ORDER BY damerau_levenshtein(first_name, '{inputs.first_name_search}')
LIMIT 10 -- Optionally limit to only show the 10 closest results
Options
Name of the text input, used to reference the selected value elsewhere as {inputs.name.value}
- Options:
- string
Title displayed above the text input
- Options:
- string
Alternative placeholder text displayed in the text input
- Options:
- string
- Default:
- Type to search