Header and menu

The header appears at the top of every page, with your logo and a navigation menu that collapses into a toggle on small screens.

On this page

The header is rendered by the header.hbs template and most of its appearance is controlled by the Header elements theme settings, so you won’t usually need to change its markup.

Usage

The .header element uses the theme’s header Alpine.js component (x-data="header"), which opens and closes the menu and keeps track of whether the header is fixed or stuck to the top of the page. Inside a container, it contains:

  • A .logo-link link containing the .logo image and an optional .tagline.
  • A .menu-toggle button, with x-bind="trigger", which opens the menu on small screens. It’s hidden from the Mobile menu breakpoint up.
  • A .backdrop that covers the page while the menu is open on small screens.
  • A <nav class="nav menu"> element, with x-bind="menu", that contains the header’s links, search and dropdowns as .nav-link elements.

Header

Make your browser window narrower than the medium breakpoint to see the menu toggle.

The component adds classes to the menu based on the theme settings: .menu-{style} for the mobile menu style, .menu-{layout} for the header layout and .{breakpoint}:menu-expanded to display the menu as a row of links from the mobile menu breakpoint up. In the theme’s templates the md: prefixes above are set by the Mobile menu breakpoint setting.

The Mobile menu style setting controls how the menu opens on small screens:

OptionDescription
StandardThe menu fades in below the header.
Slide inThe menu slides in from the left of the screen, with a copy of the logo at the top.
Zoom inThe menu zooms in as a card over the page.

Set Mobile menu breakpoint to None to always show the menu toggle, at every screen size.

Header settings

NameDescription
Header layoutPositions the menu’s links on the left, in the center or on the right of the header.
Full-width headerUses a full-width container so the header spans the whole page.
Header heightSets the header height through --height-header.
Fixed headerPlaces the header over the top of the hero section, using the Header link color (fixed) setting for its links until the header becomes stuck.
Sticky headerKeeps the header at the top of the screen as visitors scroll: Never, Always or only when scrolling back up (On scroll up). A stuck header has the .is-stuck class and a shadow.
Header link colorThe color of the header’s links.
Header background colorThe background color of the header.
Header link 1–3 text/URLUp to three custom links.
Header search styleAdds a search field to the header (Inline) or a button that opens one (Button).
Category list styleAdds a Categories dropdown to the menu.
Submit a Request link and Sign In linkShows these links as plain links or as buttons, or hides them.

The language selector can also be shown in the header using the Language selector location setting in the Translations group.

To add or restyle header elements without code, use the visual builder.

Questions or feedback about this article? Let us know