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/side-nav

Side Navigation

nswds-ui/side-nav
FreeComponent

Vertical section navigation with arbitrary collapsible nesting, current-page marking and auto-expansion of the active branch.

Install it

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

Source

src/components/side-nav.tsxraw.githubusercontent.com/digitalnsw/nswds-ui/main/apps/registry/public/r/side-nav.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 { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/collapsible'
9import { Link } from '@/components/link'
10import { IconChevronRight } from '@/icons/chevron-right'
11
12/**
13 * One entry in a `SideNav` tree.
14 *
15 * - `href` and no `links` — a leaf link.
16 * - `links` — a branch. At the top level it renders as a section heading over an
17 * always-visible list; at any deeper level it renders as a collapsible
18 * trigger. A branch's own `href` is IGNORED (the row is a disclosure button,
19 * not a link) — a dev-only warning flags it, mirroring the nswds-app
20 * `SidebarNavigation` behaviour where branch rows only toggled.
21 * - Neither — a dead entry; rendered as inert text and flagged with a dev-only
22 * warning rather than a decoy `<a>` with no destination.
23 */
24type SideNavItem = {
25 /** Visible text for the link, section heading, or branch trigger. */
26 title: string
27 href?: string
28 links?: SideNavItem[]
29}
30
31/**
32 * Row treatment shared by leaf links and branch triggers — the nswds-app
33 * left-rail language: each row carries its own left border sitting exactly on
34 * the list's rail (the `-ml-px` on the `<li>`), so hover and the current-page
35 * state recolour the rail segment beside the row.
36 *
37 * Departures from the source, both deliberate:
38 * - The idle border is `border-transparent` rather than the bare `border-l`
39 * default: idle rows show the rail through their transparent border, so the
40 * idle rail colour is defined once (on the list) instead of twice.
41 * - The current row adds `dark:text-white`. The source left dark active text
42 * to fall through to the idle `dark:text-grey-400`, which on the
43 * `dark:bg-white/20` highlight is both low-contrast and cascade-order
44 * dependent; bold white ink clears WCAG 2.2 AA (1.4.3) on that overlay.
45 *
46 * The source's hover font-weight change (`hover:font-semibold`) is NOT ported.
47 * DESIGN.md's Derived State Rule has hover, active and focus deriving from one
48 * ink via `color-mix`, and a weight jump is not a derivation: it changes glyph
49 * advance widths, so a label sitting near its wrap point can reflow — and grow
50 * the row — under the pointer. The remaining hover treatment (rail colour,
51 * 10% ink tint, ink shift) already distinguishes the state without moving
52// … 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/collapsible.json
  • https://ui.digital.nsw.gov.au/registry/r/link.json
  • https://ui.digital.nsw.gov.au/registry/r/icons.json

Files it writes

  • src/components/side-nav.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