Proximity Nav

A route-aware sidebar navigation whose guide lines stretch toward the pointer, with controlled active state and a navigation-free preview mode.

Installation

npx shadcn@latest add @navui/proximity-nav

Usage

Provide destination titles and links. Keep the active destination tied to your application's route or controlled state.

import { ProximityNav } from '@/components/navui/proximity-nav'

const items = [
  { title: 'Introduction', href: '/docs/introduction' },
  { title: 'Installation', href: '/docs/installation' },
  { title: 'Components', href: '/docs/components' },
]

export function DocsSidebar() {
  return <ProximityNav items={items} label="Documentation" />
}

API reference

Custom NavUI navigation component.

Proximity Nav properties
PropTypeDefaultDescription
itemsreadonly ProximityNavItem[]—Navigation entries containing a title and destination href.
activeHrefstringdefaultActiveHref / first itemControlled active destination. When omitted, selection starts at defaultActiveHref or the first item.
defaultActiveHrefstringFirst item hrefInitial active destination for the navigation-free, uncontrolled preview mode.
preventNavigationbooleanfalsePrevents route changes and prefetching so clicks can demonstrate active state in an embedded preview.
onActiveHrefChange(href: string) => void—Called when an item is selected, for controlled state, analytics, or custom navigation behavior.
labelstring"Navigation"Accessible label for the nav landmark.
classNamestring—Classes merged onto the navigation container.

Accessibility

  • Framework-independent native links. Pass activeHref from your router for route tracking. preventNavigation demonstrates local selection. Pointer and focus effects respect reduced motion.