Site Header
Sticky, translucent site header from one nav array: brand, NavigationMenu panels from md up, a right Drawer with the same links below it, and your actions on the right. The hairline underneath appears only once content scrolls beneath it.
acme.gg
import { BookOpen, Gauge } from "lucide-react";import { SiteHeader } from "@/components/blocks/site-header";import { Button } from "@/components/ui/button";import { ThemeToggle } from "@/components/ui/theme-toggle";export function Header({ pathname }: { pathname: string }) { return ( <SiteHeader brand={<a href="/">Acme</a>} current={pathname} nav={[ { label: "Product", items: [ { title: "Dashboard", href: "/dashboard", icon: <Gauge />, description: "Usage at a glance", }, { title: "Docs", href: "/docs", icon: <BookOpen />, description: "Guides and API reference", }, ], }, { label: "Blog", href: "/blog" }, { label: "Pricing", href: "/pricing" }, ]} actions={ <> <ThemeToggle /> <Button size="sm">Sign in</Button> </> } /> );}<SiteHeader>
Sticky site header: brand, NavigationMenu from md up, a right Drawer with the same links below it. The hairline under it appears only once the page scrolls under the header.
brand*ReactNodeLogo link, e.g.
<a href="/">Acme</a>.nav*(SiteGroup | SiteLink)[]Top-level links and panels, left to right.
actionsReactNodeRight-hand controls (search, theme, sign in). Shown at every width.
currentstringHref of the current page: marks the matching link
aria-current="page".labeldefault"Main"stringAccessible name of the navigation, desktop and drawer alike.
onNavigate(href: string, event: MouseEvent<HTMLAnchorElement, MouseEvent>) => voidonClickfor every nav link, e.g. to close over client routing or stub links in a demo.
| Prop | Type | Default |
|---|---|---|
brand*Logo link, e.g. | ReactNode | — |
nav*Top-level links and panels, left to right. | (SiteGroup | SiteLink)[] | — |
actionsRight-hand controls (search, theme, sign in). Shown at every width. | ReactNode | — |
currentHref of the current page: marks the matching link | string | — |
labelAccessible name of the navigation, desktop and drawer alike. | string | "Main" |
onNavigate
| (href: string, event: MouseEvent<HTMLAnchorElement, MouseEvent>) => void | — |
- type SiteLink
- { label: string; href: string }
- type SiteGroup
- { label: string; items: { title: string; href: string; description?: ReactNode; icon?: ReactNode }[]; columns?: 1 | 2; }
* required. Every component also takes className.