Line Nav
NewmotionVertical navigation with a line marker that expands on hover and active state. Inspired by Devouring Details and Skiper UI.
$ pnpm dlx shadcn@latest add @byphongphan/line-nav@byphongphan in components.jsonOverview
Line Nav is a vertical navigation component with an authentic ruler-tick ladder indicator inspired by chanh dai, Devouring Details and Skiper UI.
It supports both a flat Basic list and a structured Grouped hierarchy, where major category headers and active items extend prominent indicator rules with spring physics.
Installation
Install dependencies:
$ pnpm add motion clsx tailwind-merge@byphongphan in components.jsonCopy and paste the component into your project:
Update the import paths to match your project aliases.
Usage
1. Basic Navigation (Flat List)
2. Grouped Navigation (Categorized)
Examples
Basic Line Nav
Flat list navigation with a continuous vertical ladder and spring-physics indicator lines:
Grouped Line Nav
Categorized sections with prominent category headers and nested sub-items:
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | LineNavItem[] | undefined | Flat array of navigation items { title, href }. |
groups | LineNavGroup[] | undefined | Categorized groups { title, href?, items }. |
activeHref | string | undefined | Controlled active item href. |
defaultActiveHref | string | First item href | Uncontrolled initial active item href. |
sublineCount | number | 2 | Number of intermediate tick marks between entries. |
scrollActiveIntoView | boolean | true | Scroll active item into view on mount. |
onItemClick | (item, event) => void | undefined | Callback fired when an item or group header is clicked. |
onActiveChange | (href: string) => void | undefined | Callback fired when the active href changes. |