{% macro live_search(
    target_selector=None,
    show=False,
    form=None,
    label=None,
    autofocus=False
) %}
    {%- set search_label = label or form.search.label.text %}

    {%- set param_extensions = {
      "label": {"text": search_label},
      "autocomplete": "off",
    } %}

    {% if autofocus %}
      {% set x=param_extensions.__setitem__("attributes", {"data-module": "autofocus"}) %}
    {% endif %}

    {% if show %}
        <div class="live-search js-header" data-module="live-search" data-targets="{{ target_selector }}">
          {{ form.search(param_extensions=param_extensions) }}
          <div aria-live="polite" class="live-search__status usa-sr-only"></div>
        </div>
    {% endif %}
{% endmacro %}
