Skip to main content

Menu with Search

JSThis component requires JavaScript.
Component status:Ready
An alternative version of the menu that includes site search.

For more information on usage, implementation and accessibility, please visit the Menu page.

Example

<div class="bux-menu-wrapper">
<div
class="bux-container bux-grid bux-container__menu bux-container__menu--with-search"
>
<nav
id="bux-main-menu"
aria-label="Main Navigation"
class="disclosure-nav disclosure-nav-orientation-horizontal"
>
<ul class="bux-menu">
<li class="bux-menu__item">
<a
href="#"
class="bux-menu__link bux-menu__link--active disclosure-nav-item-with-submenu disclosure-nav-item-with-submenu"
>Item 1</a
>
<ul class="disclosure-nav-submenu disclosure-nav-submenu-closed">
<li class="bux-menu__item">
<a
href="#"
class="bux-menu__link disclosure-nav-item-with-submenu mobile-depth-cutoff"
>
Item 1.1
</a>
<ul
class="disclosure-nav-submenu disclosure-nav-submenu-closed mobile-visible"
>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link">Item 1.1</a>
<ul
class="disclosure-nav-submenu disclosure-nav-submenu-closed"
>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link">Item 1.1</a>
<ul
class="disclosure-nav-submenu disclosure-nav-submenu-closed"
>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link">Item 1.1</a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link">Item 1.2</a>
</li>
</ul>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link">Item 1.2</a>
</li>
</ul>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link">Item 1.2</a>
</li>
</ul>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 1.2 </a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 1.3 </a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 1.4 </a>
</li>
</ul>
</li>
<li class="bux-menu__item">
<a
href="#"
class="bux-menu__link disclosure-nav-item-with-submenu disclosure-nav-item-with-submenu"
>Item 2</a
>
<ul class="disclosure-nav-submenu disclosure-nav-submenu-closed">
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 2.1 </a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 2.2 </a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 2.3 </a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 2.4 </a>
</li>
</ul>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link">Item 3</a>
</li>
<li class="bux-menu__item">
<a
href="#"
class="bux-menu__link disclosure-nav-item-with-submenu disclosure-nav-item-with-submenu"
>Item 4</a
>
<ul class="disclosure-nav-submenu disclosure-nav-submenu-closed">
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 4.1 </a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 4.2 </a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 4.3 </a>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link"> Item 4.4 </a>
</li>
</ul>
</li>
<li class="bux-menu__item">
<a href="#" class="bux-menu__link">Item 5</a>
</li>
</ul>
</nav>
<div class="bux-menu__search">
<div class="bux-form__text-field--menu-search__wrapper">
<form id="site-search" class="bux-search" role="search">
<label class="bux-search__label visually-hidden" for="buxSearch"
>Search</label
>
<input
id="buxSearch"
class="bux-search__input bux-form__text-field bux-from__text-field--menu-search visually-hidden"
placeholder="Search"
tabindex="-1"
title="Search"
/>
<button
class="bux-search__submit visually-hidden"
aria-controls="buxSearch"
tabindex="-1"
>
<span class="visually-hidden">Submit search</span>
</button>
</form>
</div>
<button id="menuSearchBtn" type="button" aria-controls="site-search">
<span class="visually-hidden">Toggle search dialog</span
><span
id="searchIcon"
class="icon icon-search"
aria-hidden="true"
></span>
</button>
</div>
</div>
</div>

Implementation Notes

By default, mobileDepthCutoff is set to true, which hides links of a depth greater than two in the menu tree on large viewports. This is meant to overlap with the Sidebar Navigation which by default is hidden on smaller viewports.

Back to top