SiteHeader
The public pages’ top bar: wordmark, a few links, and Sign in / Create account or Open dashboard.
Examples
Signed out
Under 768px the links fold into a native popover opened by the menu button (no JavaScript).
<SiteHeader
nav={[{ label: 'How it works', href: '#how' }, { label: 'Docs', href: docsHref }]}
signInHref={routes.auth.signin.href()}
signUpHref={routes.auth.signup.href()}
dashboardHref={routes.dashboard.index.href()}
/>Signed in
<SiteHeader signedIn signInHref={…} signUpHref={…} dashboardHref={routes.dashboard.index.href()} />Usage
import { SiteHeader } from '@switchboard/ui'
<SiteHeader nav={nav} signedIn={Boolean(user)} signInHref={…} signUpHref={…} dashboardHref={…} />Props
Every component also takes mix, for css() and mixins applied after its own style.
SiteHeader
| Prop | Type | Default | Description |
|---|---|---|---|
| signInHref* | string | – | Sign in link (signed out). |
| signUpHref* | string | – | Create account link (signed out). |
| dashboardHref* | string | – | Open dashboard link (signed in). |
| signedIn | boolean | – | Swap the auth links for Open dashboard. |
| nav | { label; href; current? }[] | – | A few page links; current sets aria-current. |
| homeHref | string | '/' | Where the wordmark links. |
| backdrop | boolean | false | A faint jack field behind the column (auth and OAuth pages). |
Also accepts every <header> attribute.
Accessibility
- Renders <header> with <nav aria-label="Site">.
- On phones the nav is a native popover: Escape and outside clicks close it, and it works before hydration.
Guidance
Do
- Keep three or four links at most.
Don’t
- Use it inside the dashboard (AppHeader is that).