Live preview. Open this page under 1024px wide to see the mobile sheet.
Navbar
Floating pill navbar with three separated islands: brand, links, and tools.
The links island hides below 1024px and becomes a full screen sheet with
body scroll locked while it is open (skippable with lockScroll={false}).
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
brand |
string |
required | Wordmark text. |
brandHref |
string |
"/" |
Brand target. |
logo |
string |
unset | Logo image source. Nothing renders when omitted. |
brandTag |
string |
unset | Small pill next to the brand, such as an edition tag. |
items |
NavItem[] |
required | Nav links, one short word each. |
tools |
ReactNode |
unset | Extra tools island content, such as a theme toggle. |
gitlabUrl |
string |
unset | Outbound link with a corner arrow. Hidden when unset. |
gitlabLabel |
string |
"GitLab" |
Label for the outbound link. |
lockScroll |
boolean |
true |
Lock page scroll while the mobile sheet is open. Pass false when the navbar sits inside another page's layout, so the sheet never freezes the host page. |
The active link follows both pathname and in-page hash.
Usage
import { Navbar } from "@xeh/xehkit/components/navbar/Navbar";
import "@xeh/xehkit/xehkit.css";
<Navbar
brand="XEH"
logo="/xeh-symbol-with-bg.svg"
brandTag="hq"
items={[
{ label: "About", href: "/#about" },
{ label: "Projects", href: "/#projects" },
{ label: "Kit", href: "/xehkit" },
]}
gitlabUrl="https://gitlab.com/xehhq"
/>
Notes
- Client component. Uses
next/linkandnext/navigation. - The mobile sheet is full width below the navbar, not a slide-over drawer.
- Escape closes the sheet.
- With
lockScrollat its default, the page stops scrolling while the sheet is open. PasslockScroll={false}to keep the host page in control, which is the right choice for previews and embeds.