BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/@nswds/ui/header

Header

nswds-ui/header
FreeComponent

Top-of-page banner landmark with brand lockup, site name, version badge and a slot for header controls, in four WCAG 2.2 AAA surface colours.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/digitalnsw/nswds-ui/main/apps/registry/public/r/header.json

Source

src/components/header.tsxraw.githubusercontent.com/digitalnsw/nswds-ui/main/apps/registry/public/r/header.json · first 6 KB
1'use client'
2
3import { cva, type VariantProps } from 'class-variance-authority'
4import React from 'react'
5
6import { cn } from '@/lib/utils'
7
8import { Badge, type BadgeProps } from '@/components/badge'
9import { Link } from '@/components/link'
10import { Logo } from '@/components/logo'
11
12/**
13 * Surface colours the header can be themed with, sharing the Masthead's and
14 * SkipLink's four-name vocabulary (`dark`, `light`, `white`, `grey`) — the three
15 * components stack at the top of the page and a service picks one word for the
16 * whole chrome.
17 *
18 * Every pair is WCAG 2.2 AAA (1.4.6, 7:1), computed from the masterbrand oklch
19 * tokens. Light mode: grey-800 on white 15.1:1, grey-800 on grey-100 13.8:1,
20 * white on primary-800 14.4:1, white on grey-800 15.1:1. Dark mode deepens each
21 * surface onto the same family's dark step and clears AAA more comfortably
22 * still (17.2:1–20.2:1).
23 *
24 * Unlike the Masthead — a brand strip whose light/white/grey surfaces are frozen
25 * across themes — the header is the page's own surface, so all four follow the
26 * theme. Pair `Header color="dark"` with `Masthead color="dark"` when a service
27 * wants the two to match in both modes.
28 */
29const headerColors = {
30 // Ink values use the RAW masterbrand tokens (--grey-800) rather than
31 // Tailwind's --color-* bridge aliases: Tailwind v4 tree-shakes an
32 // unreferenced @theme key, and referencing one from inside an arbitrary
33 // property is not a usage signal. Same reasoning as footer.tsx.
34 // (--color-white is safe: `text-white` below is a real utility.)
35 dark: 'bg-primary-800 text-white [--header-ink:var(--color-white)] dark:bg-primary-950',
36 light:
37 'bg-grey-100 text-grey-800 [--header-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--header-ink:var(--color-white)]',
38 white:
39 'bg-white text-grey-800 [--header-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--header-ink:var(--color-white)]',
40 grey: 'bg-grey-800 text-white [--header-ink:var(--color-white)] dark:bg-grey-950',
41}
42
43type HeaderColor = keyof typeof headerColors
44
45// Shared by cva's defaultVariants, the data-color attribute and the logo
46// context, so the four can't drift apart.
47const DEFAULT_HEADER_COLOR: HeaderColor = 'white'
48
49const headerVariants = cva(
50 [
51 'w-full',
52 // The hairline rule derives from the surface's own ink, so it follows every
53 // colour variant and both themes from one value. Mirrors the color-mix
54// … truncated

What it pulls in

npm packages

  • class-variance-authority
  • clsx
  • tailwind-merge

Other registry items

  • https://ui.digital.nsw.gov.au/registry/r/theme.json
  • https://ui.digital.nsw.gov.au/registry/r/badge.json
  • https://ui.digital.nsw.gov.au/registry/r/link.json
  • https://ui.digital.nsw.gov.au/registry/r/logo.json

Files it writes

  • src/components/header.tsx
  • src/lib/utils.ts

Facts

Registry
@nswds/ui
Type
registry:ui
Access
Free
Files written
2
Licence
MIT
In the index
at or before 2026-08-20
Last confirmed
today

Go to the source

ui.digital.nsw.gov.au digitalnsw/nswds-ui on GitHub Raw registry item This item as JSON

More from @nswds/ui

All 46 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Aspect Ratioaspect-ratio@nswds/uiComponentsFree2 deps · 2 files
Badgebadge@nswds/uiComponentsFree4 deps · 2 files
Buttonbutton@nswds/uiComponentsFree4 deps · 2 files
Cardcard@nswds/uiComponentsFree2 deps · 2 files
Collapsiblecollapsible@nswds/uiComponentsFree1 dep
Drawerdrawer@nswds/uiComponentsFree3 deps · 2 files
Expandable Searchexpandable-search@nswds/uiComponentsFree3 deps · 2 files
Fieldfield@nswds/uiComponentsFree4 deps · 2 files

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

KitGrade

SaaS starter kits, scored on what can be checked

kitgrade.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex