Search Form

The Search Form is an entrypoint into a search service by allowing users to enter keywords.

Variations

Default Search

open this example in its own window

<form class="search-form" action="#">
  <div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
    <div class="input-group">
      <input
        type="text"
        class="form-control"
        placeholder="Search"
        value=""
        aria-label="Search"
      />
      <button type="button" class="btn-close" aria-label="Close" disabled>
        <span class="visually-hidden">Close</span>
      </button>
      <button type="submit" class="btn btn-btn-outline-secondary">
        <span class="visually-hidden">Search</span>
        <i class="fas fa-search" aria-hidden="true"></i>
      </button>
    </div>
  </div>
</form>

Options to the searchForm() macro

action: string

The form's action href.

large: boolean = false

Whether to display a large Search component.

{% from 'macros/component/search-form.html' import searchForm %}

{{ searchForm({
    'action': '#'
}) }}

Large Search

open this example in its own window

<form class="search-form" action="#">
  <div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
    <div class="input-group input-group-lg">
      <input
        type="text"
        class="form-control"
        placeholder="Search"
        value=""
        aria-label="Search"
      />
      <button type="button" class="btn-close" aria-label="Close" disabled>
        <span class="visually-hidden">Close</span>
      </button>
      <button type="submit" class="btn btn-btn-outline-secondary">
        <span class="visually-hidden">Search</span>
        <i class="fas fa-search" aria-hidden="true"></i>
      </button>
    </div>
  </div>
</form>

Options to the searchForm() macro

action: string

The form's action href.

large: boolean = false

Whether to display a large Search component.

{% from 'macros/component/search-form.html' import searchForm %}

{{ searchForm({
    'action': '#',
    'large': true
}) }}

Patterns

This component is used in the following design patterns: