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/push-menu

Push Menu

nswds-ui/push-menu
FreeComponent

Multi-level drill-down navigation menu with slide transitions, focus management and inert parked levels, for mobile drawers.

Install it

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

Source

src/components/push-menu.tsxraw.githubusercontent.com/digitalnsw/nswds-ui/main/apps/registry/public/r/push-menu.json · first 6 KB
1'use client'
2
3import React from 'react'
4
5import { cn } from '@/lib/utils'
6
7import { Button } from '@/components/button'
8import { Link } from '@/components/link'
9import { IconChevronRight } from '@/icons/chevron-right'
10import { IconClose } from '@/icons/close'
11import { IconWest } from '@/icons/west'
12
13/**
14 * Default slide duration for level transitions, in milliseconds — the default
15 * of the `durationMs` prop.
16 *
17 * COUPLING: `durationMs` drives BOTH the `--push-menu-duration` custom
18 * property (set inline on the root, read by the CSS transition) and the state
19 * machine's `setTimeout`s (which settle the animation state, pop levels, and
20 * schedule focus restoration). Do not override the custom property directly —
21 * that changes only the visual duration while the state machine still settles
22 * on `durationMs`, desyncing the two; pass `durationMs` instead. Under
23 * `prefers-reduced-motion` the slide is skipped (the transition is applied
24 * under `motion-safe:` only) but the state machine still waits the full
25 * duration; the menu is simply "settled early" for those users, never broken.
26 */
27const PUSH_MENU_DURATION_MS = 300
28
29/** A node in the menu tree. Items with `links` drill in; items with `href` navigate. */
30type PushMenuItem = {
31 /** Unique across the whole tree — level ids and focus restoration track items by id. */
32 id: string
33 /** Visible label. */
34 title: string
35 /** Navigation target for leaf items. Ignored for drilling when `links` is non-empty. */
36 href?: string
37 /** Child items. A non-empty array makes this item a drill-in button, not a link. */
38 links?: PushMenuItem[]
39}
40
41/** One entry in the level stack — the root level plus one per drill-in. */
42type PushMenuLevel = {
43 id: string
44 title: string
45 /** 1 for the root level, incrementing per drill-in. */
46 depth: number
47 items: PushMenuItem[]
48 /** The item whose activation opened this level. Absent on the root level. */
49 parentItem?: PushMenuItem
50}
51
52type PushMenuAnimationState = 'idle' | 'sliding-forward' | 'sliding-backward'
53
54function buildLevelId(path: string[]): string {
55 return `level-${path.length > 0 ? path.join('--') : 'root'}`
56}
57
58/**
59 * Truncates to at most `maxLength` UTF-16 units, ellipsis included in the
60 * budget.
61 *
62 * Iterates CODE POINTS (`for…of` over a string) rather than slicing by index:
63 * a plain `slice` can cut between the two halves of a surrogate pair, leaving
64 * a lone surrogate that renders as U+FFFD (an emoji in a level title was
65// … truncated

What it pulls in

npm packages

  • clsx
  • tailwind-merge

Other registry items

  • https://ui.digital.nsw.gov.au/registry/r/theme.json
  • https://ui.digital.nsw.gov.au/registry/r/button.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/push-menu.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