Search
The Search pattern lets users search a site for a phrase or keyword.
Usage guidance
- Use the large search by default. Only use the small search for pages that need their own search (for example search results within a page).
- The ‘Header’ pattern shows how to integrate the search into the navigation on mobile versus desktop.
Small search for sidebar
HTML
<form action="/search" method="get" class="sidebar-search-container est-search-container col-5 col-sm-5 col-12">
<label for="search-input" class="visually-hidden">Search:</label>
<input type="search" id="search-input" name="query" class="search-input" placeholder="Search" aria-label="Search" oninput="toggleClearButton('search-input', 'clear-button-small')">
<button type="button" id="clear-button-small" class="clear-search" aria-label="Clear search" onclick="clearSearch('search-input', 'clear-button-small')" style="display:none;">
✕
</button>
<button type="submit" class="search-button" aria-label="Submit search">
<span class="visually-hidden">Submit search</span>
</button>
</form>
Large search
HTML
<div class="large-search-wrap col-10 col-lg-10 col-12">
<form action="/search" method="get" class="large-search-container est-search-container">
<label for="search-input" class="visually-hidden">Search:</label>
<input type="search" id="large-search-input" name="query" class="search-input" placeholder="Search" aria-label="Search" oninput="showSuggestions(); toggleClearButton('large-search-input', 'clear-button-large')">
<button type="button" id="clear-button-large" class="clear-search" aria-label="Clear search" onclick="clearSearch('large-search-input', 'clear-button-large')" style="display:none;">
✕
</button>
<button type="submit" class="search-button">
<span class="visually-hidden">Submit search</span>
</button>
</form>
<div id="suggestions-container" class="suggestions-container" style="display:none;"></div>
</div>