Search Live
Searches entries on keyup (Blitz, Campaign, Sherlock, etc.).
{{ sprig('_components/search-live') }}
{#--- _components/search-live.twig ---#}
{% set query = query ?? '' %}
<input sprig type="text" name="query" value="{{ query }}"
s-trigger="keyup changed delay:300ms"
s-replace="#results"
>
<div id="results">
{% if query %}
{% set entries = craft.entries.search(query).all() %}
{% for entry in entries %}
{{ entry.title }}
{% endfor %}
{% endif %}
</div>