Header and menu
The header is set once per demo in demo.json and appears on every page. The mobile menu is created from the same settings automatically.
Menu links and dropdowns#
"nav": [
{ "label": "Home", "href": "index.html" },
{ "label": "Menus", "href": "menu.html", "match": "menu",
"children": [
{ "label": "Dinner", "href": "menu-dinner.html" },
{ "label": "Drinks", "href": "menu-drinks.html" }
]
},
{ "label": "Book a table", "href": "reservations.html" },
{ "label": "Contact", "href": "contact.html" }
]labelis the text,hrefthe page it opens (a page file name, a#section-idon the same page, or a fullhttps://address).childrenturns an item into a dropdown. On phones it becomes a tap-to-open list.match(optional) highlights the item on every page whose file name starts with that text, e.g."match": "menu"keeps “Menus” highlighted onmenu-dinner.html.- The current page is highlighted automatically.
One-page layouts: if a demo has no nav, the menu is built from sections on the current page that have both an "id" and a "nav" label, and the links scroll to them.
The header button#
"header": {
"cta": { "label": "Book a table", "href": "reservations.html", "icon": "calendar-check" }
}icon is any Bootstrap Icons name without bi-. Add "style": "outline" for an outlined button. Remove cta to remove the button.
Top bar#
"header": {
"topbar": {
"items": [
{ "icon": "telephone", "text": "+1 (555) 013-4400" },
{ "icon": "clock", "text": "Open daily 5pm – 11pm" }
]
}
}The thin bar above the menu, with your social icons on the right. "topbar": {} shows your phone and email; remove topbar to hide it. On phones only the first item is shown.
Header styles#
"style" | Looks like | Use it over |
|---|---|---|
"transparent" | See-through with white text; turns solid white when you scroll. | Dark photo heroes. |
"transparent-dark" | See-through with dark text; turns solid when you scroll. | Light heroes. |
"light" | Solid white bar. | Anything. |
"dark" | Solid dark bar. | Anything. |
If you don't set a style, the right one is picked from the first section of each page. To force one for the whole demo, set "header": { "style": "light" } in demo.json.
Different header on one page#
A page file can override the demo's header settings:
{
"title": "Sign in",
"header": { "style": "light", "topbar": null },
"sections": [ … ]
}null removes a setting on that page only.
Editing the menu in the HTML files#
The desktop menu is the <ul class="nav-o"> list and the phone menu is <ul class="mobile-links"> inside <div id="mobileNav">. Change both, on every page (use Replace in Files). A dropdown looks like this:
<li class="has-dropdown">
<a href="menu.html" aria-haspopup="true">Menus <i class="bi bi-chevron-down dd-caret" aria-hidden="true"></i></a>
<ul class="dropdown-o">
<li><a href="menu-dinner.html">Dinner</a></li>
<li><a href="menu-drinks.html">Drinks</a></li>
</ul>
</li>