Headers & navigation / Headers & nav bars
Hairline Site Header
Slim white bar with a 1px bottom border, logo left, text nav with chevron dropdown triggers (Product, Developers, Solutions) plus plain links, and on the right a GitHub star-count chip, a white outlined Sign in button and a solid emerald CTA. Content aligned to a 1128px container.
Rebuilt from supabase.com in the Emerald Paper Precision style.
Looks exactly like supabase.com: brings its fonts and colours, namespaced so your own theme stays untouched.
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Props: brand, stars, signInLabel, ctaLabel and items (nav entries; give an item a `menu` array of {title, desc} for a chevron dropdown). Renders standalone with defaults; the nav hides below md.
components/hairline-nav-bar.tsx
import { useState } from "react"; type NavItem = { label: string; href: string; menu?: { title: string; desc: string }[] }; export default function HairlineSiteHeader({ brand = "Northwind", stars = "8.2K", signInLabel = "Sign in", ctaLabel = "Get started", items = [ { label: "Platform", href: "#", menu: [{ title: "Database", desc: "Managed tables and queries" }, { title: "Storage", desc: "Files with simple rules" }, { title: "Functions", desc: "Run code at the edge" }] }, { label: "Resources", href: "#", menu: [{ title: "Guides", desc: "Step by step walkthroughs" }, { title: "Examples", desc: "Starter projects" }] }, { label: "Teams", href: "#", menu: [{ title: "Startups", desc: "Ship the first version" }, { title: "Enterprise", desc: "Scale with control" }] }, { label: "Pricing", href: "#" }, { label: "Docs", href: "#" }, { label: "Journal", href: "#" }, ] as NavItem[], }) { const [open, setOpen] = useState<string | null>(null); return ( <header className="relative z-40 w-full border-b border-hairline bg-canvas font-sans text-ink"> <style>{`@keyframes hsh-pop{from{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes hsh-in{from{opacity:0}to{opacity:1}}`}</style> <div className="mx-auto flex h-16 max-w-[1128px] items-center justify-between px-4"> <div className="flex items-center gap-8"> <a href="#" className="flex items-center gap-2 rounded-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand" aria-label={brand}> <svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path d="M13 2 4 14h7l-1 8 9-12h-7z" className="fill-brand-bright" /></svg> <span className="font-display text-[19px] font-semibold tracking-[-0.03em]">{brand.toLowerCase()}</span> </a> <nav aria-label="Main" className="hidden items-center gap-1 md:flex"> {items.map((it) => ( <div key={it.label} className="relative" onMouseEnter={() => it.menu && setOpen(it.label)} onMouseLeave={() => setOpen(null)}> {it.menu ? ( <button type="button" aria-expanded={open === it.label} onFocus={() => setOpen(it.label)} className="group flex items-center gap-1 rounded-md px-3 py-2 text-[15px] text-ink transition-colors duration-hover-color ease-hover-color hover:text-brand focus-visible:text-brand focus-visible:outline-none"> {it.label} <svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" strokeWidth="1.4" className="text-ink-muted"><path d="m2 3.5 3 3 3-3" /></svg> </button> ) : ( <a href={it.href} className="block rounded-md px-3 py-2 text-[15px] text-ink transition-colors duration-hover-color ease-hover-color hover:text-brand focus-visible:text-brand focus-visible:outline-none">{it.label}</a> )} {it.menu && open === it.label && ( <div className="absolute left-0 top-full w-64 pt-2" style={{ animation: "hsh-pop 160ms ease-out", transformOrigin: "top left" }}> <ul className="rounded-xl border border-hairline bg-surface p-2 shadow-popover"> {it.menu.map((m) => ( <li key={m.title}> <a href="#" className="block rounded-lg px-3 py-2 hover:bg-surface-muted"> <p className="text-label text-ink">{m.title}</p> <p className="text-caption text-ink-muted">{m.desc}</p> </a> </li> ))} </ul> </div> )} </div> ))} </nav> </div> <div className="flex items-center gap-3" style={{ animation: "hsh-in 300ms linear 300ms both" }}> <a href="#" className="hidden items-center gap-2 rounded-md px-3 py-1.5 text-[13px] text-ink-soft transition-colors duration-hover-color ease-hover-color hover:bg-black/[0.04] hover:text-ink sm:flex" aria-label={`${stars} stars on GitHub`}> <svg width="18" height="18" viewBox="0 0 16 16" fill="currentColor" className="text-ink" aria-hidden="true"><path d="M8 0a8 8 0 0 0-2.5 15.6c.4.1.5-.2.5-.4v-1.4c-2.2.5-2.7-1-2.7-1-.4-.9-.9-1.2-.9-1.2-.7-.5.1-.5.1-.5.8.1 1.2.8 1.2.8.7 1.200 1.900.9 2.300.7.1-.5.3-.9.5-1.100-1.800-.2-3.600-.9-3.600-4 0-.9.3-1.600.8-2.100-.1-.2-.4-1 .1-2.100 0 0 .7-.2 2.200.8a7.500 7.500 0 0 1 4 0c1.500-1 2.200-.8 2.200-.8.4 1.100.2 1.900.1 2.100.5.6.8 1.300.8 2.100 0 3.100-1.900 3.800-3.700 4 .3.3.6.8.6 1.500v2.200c0 .2.1.5.6.4A8 8 0 0 0 8 0z" /></svg> {stars} </a> <a href="#" className="rounded-md border border-hairline-strong bg-surface px-3 py-1.5 text-[13px] font-medium text-ink transition-colors duration-hover-color ease-hover-color hover:border-ink-faint focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand">{signInLabel}</a> <a href="#" className="rounded-md bg-brand px-3 py-1.5 text-[13px] font-medium text-white transition-colors duration-hover-color ease-hover-color hover:bg-brand-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand">{ctaLabel}</a> </div> </div> </header> ); }import { useState } from "react"; type NavItem = { label: string; href: string; menu?: { title: string; desc: string }[] }; export default function HairlineSiteHeader({ brand = "Northwind", stars = "8.2K", signInLabel = "Sign in", ctaLabel = "Get started", items = [ { label: "Platform", href: "#", menu: [{ title: "Database", desc: "Managed tables and queries" }, { title: "Storage", desc: "Files with simple rules" }, { title: "Functions", desc: "Run code at the edge" }] }, { label: "Resources", href: "#", menu: [{ title: "Guides", desc: "Step by step walkthroughs" }, { title: "Examples", desc: "Starter projects" }] }, { label: "Teams", href: "#", menu: [{ title: "Startups", desc: "Ship the first version" }, { title: "Enterprise", desc: "Scale with control" }] }, { label: "Pricing", href: "#" }, { label: "Docs", href: "#" }, { label: "Journal", href: "#" }, ] as NavItem[], }) { const [open, setOpen] = useState<string | null>(null); return ( <header className="relative z-40 w-full border-b border-border bg-background font-sans text-foreground"> <style>{`@keyframes hsh-pop{from{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes hsh-in{from{opacity:0}to{opacity:1}}`}</style> <div className="mx-auto flex h-16 max-w-[1128px] items-center justify-between px-4"> <div className="flex items-center gap-8"> <a href="#" className="flex items-center gap-2 rounded-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary" aria-label={brand}> <svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path d="M13 2 4 14h7l-1 8 9-12h-7z" className="fill-primary" /></svg> <span className="font-sans text-[19px] font-semibold tracking-[-0.03em]">{brand.toLowerCase()}</span> </a> <nav aria-label="Main" className="hidden items-center gap-1 md:flex"> {items.map((it) => ( <div key={it.label} className="relative" onMouseEnter={() => it.menu && setOpen(it.label)} onMouseLeave={() => setOpen(null)}> {it.menu ? ( <button type="button" aria-expanded={open === it.label} onFocus={() => setOpen(it.label)} className="group flex items-center gap-1 rounded-md px-3 py-2 text-[15px] text-foreground transition-colors duration-emerald-hover-color ease-emerald-hover-color hover:text-primary focus-visible:text-primary focus-visible:outline-none"> {it.label} <svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" strokeWidth="1.4" className="text-muted-foreground"><path d="m2 3.5 3 3 3-3" /></svg> </button> ) : ( <a href={it.href} className="block rounded-md px-3 py-2 text-[15px] text-foreground transition-colors duration-emerald-hover-color ease-emerald-hover-color hover:text-primary focus-visible:text-primary focus-visible:outline-none">{it.label}</a> )} {it.menu && open === it.label && ( <div className="absolute left-0 top-full w-64 pt-2" style={{ animation: "hsh-pop 160ms ease-out", transformOrigin: "top left" }}> <ul className="rounded-xl border border-border bg-card p-2 shadow-emerald-popover"> {it.menu.map((m) => ( <li key={m.title}> <a href="#" className="block rounded-lg px-3 py-2 hover:bg-muted"> <p className="text-emerald-label text-foreground">{m.title}</p> <p className="text-emerald-caption text-muted-foreground">{m.desc}</p> </a> </li> ))} </ul> </div> )} </div> ))} </nav> </div> <div className="flex items-center gap-3" style={{ animation: "hsh-in 300ms linear 300ms both" }}> <a href="#" className="hidden items-center gap-2 rounded-md px-3 py-1.5 text-[13px] text-muted-foreground transition-colors duration-emerald-hover-color ease-emerald-hover-color hover:bg-foreground/[0.04] hover:text-foreground sm:flex" aria-label={`${stars} stars on GitHub`}> <svg width="18" height="18" viewBox="0 0 16 16" fill="currentColor" className="text-foreground" aria-hidden="true"><path d="M8 0a8 8 0 0 0-2.5 15.6c.4.1.5-.2.5-.4v-1.4c-2.2.5-2.7-1-2.7-1-.4-.9-.9-1.2-.9-1.2-.7-.5.1-.5.1-.5.8.1 1.2.8 1.2.8.7 1.200 1.900.9 2.300.7.1-.5.3-.9.5-1.100-1.800-.2-3.600-.9-3.600-4 0-.9.3-1.600.8-2.100-.1-.2-.4-1 .1-2.100 0 0 .7-.2 2.200.8a7.500 7.500 0 0 1 4 0c1.500-1 2.200-.8 2.200-.8.4 1.100.2 1.900.1 2.100.5.6.8 1.300.8 2.100 0 3.100-1.900 3.800-3.700 4 .3.3.6.8.6 1.500v2.200c0 .2.1.5.6.4A8 8 0 0 0 8 0z" /></svg> {stars} </a> <a href="#" className="rounded-md border border-border bg-card px-3 py-1.5 text-[13px] font-medium text-foreground transition-colors duration-emerald-hover-color ease-emerald-hover-color hover:border-muted-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary">{signInLabel}</a> <a href="#" className="rounded-md bg-primary px-3 py-1.5 text-[13px] font-medium text-primary-foreground transition-colors duration-emerald-hover-color ease-emerald-hover-color hover:bg-primary/90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary">{ctaLabel}</a> </div> </div> </header> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: passedNo serious accessibility problems (axe-core): readable contrast, labelled buttons and images.
- Responsive: not passedScrolls sideways at tablet width (768px)
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.