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-linklink containing the.logoimage and an optional.tagline. - A
.menu-togglebutton, withx-bind="trigger", which opens the menu on small screens. It’s hidden from the Mobile menu breakpoint up. - A
.backdropthat covers the page while the menu is open on small screens. - A
<nav class="nav menu">element, withx-bind="menu", that contains the header’s links, search and dropdowns as.nav-linkelements.
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.
Menu styles
The Mobile menu style setting controls how the menu opens on small screens:
| Option | Description |
|---|---|
| Standard | The menu fades in below the header. |
| Slide in | The menu slides in from the left of the screen, with a copy of the logo at the top. |
| Zoom in | The 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
| Name | Description |
|---|---|
| Header layout | Positions the menu’s links on the left, in the center or on the right of the header. |
| Full-width header | Uses a full-width container so the header spans the whole page. |
| Header height | Sets the header height through --height-header. |
| Fixed header | Places 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 header | Keeps 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 color | The color of the header’s links. |
| Header background color | The background color of the header. |
| Header link 1–3 text/URL | Up to three custom links. |
| Header search style | Adds a search field to the header (Inline) or a button that opens one (Button). |
| Category list style | Adds a Categories dropdown to the menu. |
| Submit a Request link and Sign In link | Shows 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.