For the complete documentation index, see llms.txt. This page is also available as Markdown.

Searchbox

Configure search inputs, buttons, and suggestion behavior.

Documentation

The ff-searchbox wraps a regular HTML <input> element. Simply place <input> between <ff-searchbox> tags. On ENTER a search query to FactFinder is fired with the current input value.

<ff-searchbox>
    <input />
</ff-searchbox>

Placeholder

Because the ff-searchbox does not limit features of HTML it wraps, you can use all the standard attributes of <input> such as placeholder.

<ff-searchbox>
    <input placeholder="Search..." />
</ff-searchbox>

Select input value on click

With the select-onclick attribute you can define whether the value should be selected when the search box gets focus. (default is "false")

<ff-searchbox select-onclick="true">
    <input />
</ff-searchbox>

Adding Suggest

If you want a Suggest functionality on your page you can set the use-suggest attribute to "true" (default is "true"). You also need to implement the ff-suggest tag on your page. For more information take a look at the Suggest Example. The Suggest will only trigger when at least 2 characters are typed in the input field.

On Focus

With the property suggest-onfocus set to "true", the Suggest will open when the user clicks into the input or the input gets focus.

Hiding Suggest

Usually, you want the Suggest to disappear once the user clicks somewhere else. This happens with the default settings.

The default settings are no longer recommended, however.

Instead, you should prefer to set ff-searchbox's hide-suggest-onblur attribute to "false" and set ff-suggest's hide-onblur to "true".

See ff-suggest for more details.

Wrapping button element with ff-searchbutton

The ff-searchbutton wraps a regular HTML <button> element. Surrounded with <ff-searchbutton> tag it becomes a special button which connects to the search box and sends a search request to FactFinder.

Demo

API code

Properties

Properties
Name
Description

suggest-onfocus (String) Options: "true", "false" (default: "false")

Displays a FactFinder Suggest recommendation when the search box receives focus.

hide-suggest-onblur (String) Options: "true", "false" (default: "true")

Set this to "false" and use ff-suggest's hide-onblur="true" instead.

select-onclick (String) Options: "true", "false" (default: "false")

Selects the search box contents when clicked.

use-suggest (String) Options: "true", "false" (default: "true")

Sends suggest requests while a user types.

suggest-delay (Number) (default: 0)

Waits before sending a suggest request.

value (String) (default: empty)

Gets or sets the related <input> value.

show-asterisk-query (String) Options: "true", "false" (default: "false")

Shows a single asterisk query in the input field.

Events

Events
Name
Description

before-search

Fires before a search and provides the current search event.

before-suggest

Fires before a suggest request and provides the current suggest event.

Methods

Methods
Name
Description

search()

Starts a search.

resetInput(selector = 'input')

Sets the nested input element.

ff-searchbutton

Methods

Methods
Name
Description

resetButton(selector = 'button')

Sets the nested button element.

Events

Events
Name
Description

before-search

Fires when the button is pressed.

Last updated

Was this helpful?