SiteHeader
Sticky marketing/site header: brand, horizontal navigation with prefix-aware active states, optional mega-menu panels, right-aligned actions and a mobile drawer.
Design intent
Marketing sites repeat brand/nav/actions/mobile-menu wiring with custom active matching. SiteHeader standardizes the bar, handles /docs matching /docs/components, and stays router-agnostic via linkComponent.
npx @slipstream-ui/cli@latest add site-headerProps
| Prop | Type | Default | Description |
|---|---|---|---|
| brand | ReactNode | required | Brand slot, wrapped in a link to /. |
| items | SiteNavItem[] | required | Primary nav. Flat links are { href, label, external?, description? }; adding columns: SiteNavColumn[] turns the item into a disclosure trigger with a desktop mega panel and a mobile <details> group. |
| activeHref | string | — | Current route for active styling (aria-current="page"). |
| match | 'prefix' | 'exact' | 'prefix' | Prefix highlights parents (/docs on /docs/x); exact only identical hrefs. |
| actions | ReactNode | — | Right-aligned actions (theme toggle, GitHub, CTA). |
| mobileActions | ReactNode | — | Actions rendered inside the mobile drawer; defaults to actions. |
| linkComponent | React.ElementType | — | Router link element (Next Link, react-router Link). |
| linkHrefProp | 'href' | 'to' | 'href' | Prop used to pass the destination to linkComponent; use to for react-router-style routers. |
| brandLabel | string | 'Home' | Accessible name for the brand link. |
| navLabel | string | 'Main' | Accessible name for the desktop navigation landmark. |
| mobileNavLabel | string | 'Mobile' | Accessible name for the mobile navigation landmark. |
| sticky | boolean | true | Pin the bar to the top. |
| mobileLabel | string | 'Menu' | Title of the mobile navigation drawer. |
| showMobileTrigger | boolean | true | Render the built-in mobile trigger and drawer; set false when the host owns mobile navigation. |
| desktopBreakpoint | 'md' | 'lg' | 'md' | Breakpoint where the horizontal navigation appears. |
| navClassName | string | — | Extra classes for the inner nav row (height, padding). |
Anti-patterns
validate_usage is the MCP tool that rejects these mistakes: the same list agents see over MCP and in the canonical markdown.
Don't use it for admin rails
Vertical app navigation belongs in Sidebar + AppShell.
tsx// Avoid<SiteHeader items={adminNav} />// Prefer<AppShell sidebar={<Sidebar sections={sections} />}>…</AppShell>
Accessibility
- Active link carries aria-current="page" with prefix-aware matching.
- Mega-menu items are disclosure buttons (aria-expanded/aria-controls); Escape or an outside pointer closes the panel, ArrowDown moves focus into it.
- Mobile navigation opens in a focus-trapped Drawer; column items become native <details> groups.
- External items get target=_blank + rel=noopener.
Content guidelines
Nav labels
- 1-2 nouns
- Parallel phrasing
Good examples
- Docs
- Pricing
- Changelog
Bad examples
- Click here for docs
Composition
Compose with SiteFooter: Pair header and footer for a complete marketing shell
<SiteHeader … /><main /><SiteFooter … />
Compose with Drawer: The mobile menu is a Drawer automatically
<SiteHeader … />
Related components: SiteFooter, AppShell, Link
Dependencies
What the registry installs alongside this component. Package imports already include these.
npm packages
- class-variance-authority
- clsx
- tailwind-merge
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.