Turn It On#
Add auto to the search tag:
{{ search auto }} <input type="search" placeholder="Search posts"> <button>Search</button>{{ /search }}{{ query:posts search }} <article> <h2><a href="{{ url }}">{{ title }}</a></h2> </article>{{ /query:posts }}TemplateX connects the form to the matching query results and swaps the results after the URL changes.
The matching query keeps its authored layout. Automatic search uses non-rendering result markers, so a query inside a grid or flex container still leaves each rendered item as a direct child of that container.
Delay#
The default delay is 300 milliseconds. Change it with delay or debounce:
{{ search auto delay="450" }} <input type="search" placeholder="Search"> <button>Search</button>{{ /search }}Use a slightly longer delay when the page has expensive queries.
Filters Also Enhance Search#
Search forms that contain {{ filter:* }} controls are enhanced automatically, because changing a filter should refresh the matching results.
{{ search }} <input type="search" placeholder="Search"> {{ filter:category type="select" }}{{ /search }}The form still uses normal GET parameters, so the filtered URL can be shared or refreshed. See Search Filters for the filter syntax.