Skip to content
Statix Design System

Patterns · Marketing

Site header

The top bar of every Statix page: logo, main navigation and a few actions on one 72px white row. On phones the links fold into a menu.

import * as SiteHeader from '@statix/ui/site-header';

Examples

Customer area

Full width with 48px side padding. The current page gets a 2px ink underline on the hairline. Phone and initials sit on the right.

<script lang="ts">
	import * as SiteHeader from '@statix/ui/site-header';
	import * as Avatar from '@statix/ui/avatar';
	import { Button } from '@statix/ui/button';
	import PhoneIcon from '@lucide/svelte/icons/phone';
</script>

<SiteHeader.Root>
	<SiteHeader.Brand href="#start" />
	<SiteHeader.Nav>
		<SiteHeader.Link href="#start" active>Start</SiteHeader.Link>
		<SiteHeader.Link href="#websites">Websites</SiteHeader.Link>
		<SiteHeader.Link href="#email">Email</SiteHeader.Link>
		<SiteHeader.Link href="#domains">Domains</SiteHeader.Link>
		<SiteHeader.Link href="#invoices">Invoices</SiteHeader.Link>
	</SiteHeader.Nav>
	<SiteHeader.Actions>
		<Button href="tel:+4940468970790" variant="ghost" size="sm" class="max-tablet:px-2.5">
			<PhoneIcon data-icon="inline-start" />
			<span class="sr-only tablet:not-sr-only">040 468 970 790</span>
		</Button>
		<Avatar.Root>
			<Avatar.Fallback
				class="bg-primary-soft text-label font-semibold text-primary-soft-foreground"
			>
				LB
			</Avatar.Fallback>
		</Avatar.Root>
	</SiteHeader.Actions>
</SiteHeader.Root>

Marketing site

size="page" lines the row up with the page Container. menuFooter adds the call to action to the phone menu.

<script lang="ts">
	import * as SiteHeader from '@statix/ui/site-header';
	import { Button } from '@statix/ui/button';
</script>

<SiteHeader.Root size="page">
	<SiteHeader.Brand href="#home" aria-label="Statix home" />
	<SiteHeader.Nav>
		<SiteHeader.Link href="#hosting" active>Hosting</SiteHeader.Link>
		<SiteHeader.Link href="#domains">Domains</SiteHeader.Link>
		<SiteHeader.Link href="#care">Care</SiteHeader.Link>
		<SiteHeader.Link href="#optimisation">Optimisation</SiteHeader.Link>
		{#snippet menuFooter()}
			<Button href="#contact" variant="dark" size="lg" class="w-full">Book a call</Button>
			<Button href="#login" variant="ghost" class="w-full">Log in</Button>
		{/snippet}
	</SiteHeader.Nav>
	<SiteHeader.Actions class="max-tablet:hidden">
		<Button href="#login" variant="ghost">Log in</Button>
		<Button href="#contact" variant="dark">Book a call</Button>
	</SiteHeader.Actions>
</SiteHeader.Root>

Admin

The support tool from the Admin / Nav board. Brand children add a chip next to the logo, a link carries a count, icon buttons sit on the right.

<script lang="ts">
	import * as SiteHeader from '@statix/ui/site-header';
	import * as Avatar from '@statix/ui/avatar';
	import { Logo } from '@statix/ui/logo';
	import { Button } from '@statix/ui/button';
	import SearchIcon from '@lucide/svelte/icons/search';
	import BellIcon from '@lucide/svelte/icons/bell';
</script>

<SiteHeader.Root>
	<SiteHeader.Brand href="#overview" class="gap-3">
		<Logo />
		<span class="inline-flex h-6 items-center rounded-full bg-ink px-2.5 text-label text-white">
			Admin
		</span>
	</SiteHeader.Brand>
	<SiteHeader.Nav label="Admin">
		<SiteHeader.Link href="#overview">Overview</SiteHeader.Link>
		<SiteHeader.Link href="#customers">Customers</SiteHeader.Link>
		<SiteHeader.Link href="#support" active>
			Support
			<span
				class="inline-flex h-5 min-w-6 items-center justify-center rounded-full bg-primary px-1.5 text-label text-primary-foreground"
			>
				12<span class="sr-only"> open tickets</span>
			</span>
		</SiteHeader.Link>
		<SiteHeader.Link href="#websites">Websites</SiteHeader.Link>
		<SiteHeader.Link href="#domains">Domains</SiteHeader.Link>
	</SiteHeader.Nav>
	<SiteHeader.Actions class="gap-2">
		<Button variant="ghost" size="icon-sm" aria-label="Search"><SearchIcon /></Button>
		<Button variant="ghost" size="icon-sm" aria-label="Notifications"><BellIcon /></Button>
		<Avatar.Root class="ml-1">
			<Avatar.Fallback
				class="bg-primary-soft text-label font-semibold text-primary-soft-foreground"
			>
				JW
			</Avatar.Fallback>
		</Avatar.Root>
	</SiteHeader.Actions>
</SiteHeader.Root>

Pill indicator

indicator="pill" marks the active link with a bg-2 pill instead of the underline, as in the Nav component board.

<script lang="ts">
	import * as SiteHeader from '@statix/ui/site-header';
	import { Button } from '@statix/ui/button';
	import PhoneIcon from '@lucide/svelte/icons/phone';
</script>

<SiteHeader.Root indicator="pill">
	<SiteHeader.Brand href="#start" />
	<SiteHeader.Nav>
		<SiteHeader.Link href="#start" active>Start</SiteHeader.Link>
		<SiteHeader.Link href="#websites">Websites</SiteHeader.Link>
		<SiteHeader.Link href="#domains">Domains</SiteHeader.Link>
		<SiteHeader.Link href="#invoices">Invoices</SiteHeader.Link>
	</SiteHeader.Nav>
	<SiteHeader.Actions>
		<Button href="tel:+4940468970790" variant="ghost" size="sm">
			<PhoneIcon data-icon="inline-start" />
			<span class="sr-only tablet:not-sr-only">040 468 970 790</span>
		</Button>
	</SiteHeader.Actions>
</SiteHeader.Root>

Guidelines

Do

  • Keep the main navigation to five or six links. Put the rest in the footer.
  • Set active on exactly one link, derived from the current URL in your app.
  • Make the phone number an action in the customer area. Support is the most used way out.

Don't

  • Don’t put the primary button in the header of the customer area. It competes with the page.
  • Don’t hide the menu button on phones by removing Nav. Hide individual actions instead.

Accessibility

  • Root renders <header> (banner landmark). Nav renders <nav aria-label="Main">.
  • An active Link gets aria-current="page". The underline is decoration only.
  • Below 900px the links move into a disclosure: a button with aria-expanded and aria-controls opens the panel. Escape closes it and returns focus to the button. Choosing a link closes it too.
  • Only one of the two link lists is rendered visible at a time, so screen readers never hear them twice.
  • Brand without children renders the Logo, so a Brand link is named "Statix". Use aria-label on Brand for a longer name such as "Statix home".

API reference

SiteHeader.Root

renders <header> and accepts its attributes
PropTypeDefault
size 'full' | 'page'

full: spans the window with 48px side padding. page: capped at 1280px like Container.

'full'
sticky boolean

Stick to the top while scrolling.

false
indicator 'underline' | 'pill'

How the active link is marked: a 2px ink underline on the hairline, or a filled pill.

'underline'
open bindboolean

Whether the phone menu is open. Bind it to close the menu on navigation.

false
innerClass ClassValue

Classes for the inner row.

–
ref bindHTMLElement | null

The <header> element.

–
class ClassValue

Merged with the defaults; yours win.

–
Data attributeMeaning
data-state"open" or "closed", for the phone menu.

SiteHeader.Brand

renders <a> or <div> and accepts its attributes
PropTypeDefault
href string

Makes the brand a link, usually to the start page.

–
children Snippet

Replaces the default Logo.

–

SiteHeader.Nav

renders <nav> and accepts its attributes
PropTypeDefault
label string

Accessible name of the landmark.

'Main'
menuLabel string

Accessible name of the phone menu button.

'Menu'
menuFooter Snippet

Content under the links in the phone menu.

–
class ClassValue

Classes for the desktop <nav>.

–
Data attributeMeaning
data-slot="site-header-menu-button"The phone menu button.
data-slot="site-header-menu"The phone menu panel.

SiteHeader.Link

renders <a> and accepts its attributes
PropTypeDefault
href string

Link target.

–
active boolean

Marks the current page with aria-current="page" and the underline.

false
Data attributeMeaning
data-activePresent on the active link.

SiteHeader.Actions

renders <div> and accepts its attributes

Right-hand group for phone, account and buttons. Pushed to the end of the row.

PropTypeDefault
class ClassValue

Merged with the defaults.

–