Line Nav

Newmotion

Vertical 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
Requires @byphongphan in components.json
navigation
Loading preview...

Overview

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
Requires @byphongphan in components.json

Copy and paste the component into your project:

components/line-nav.tsx

Update the import paths to match your project aliases.


Usage

1. Basic Navigation (Flat List)

import { LineNav } from "@/components/line-nav"
const items = [ { title: "Pixel preloader", href: "#pixel-preloader" }, { title: "Box loading preloader", href: "#box-loading-preloader" }, { title: "Vercel Liquid simulation", href: "#vercel-liquid" }, { title: "Ascii Simulation", href: "#ascii-simulation" }, { title: "Interactive3d Hero", href: "#interactive3d-hero" },]
export function BasicExample() { return <LineNav items={items} activeHref="#pixel-preloader" />}

2. Grouped Navigation (Categorized)

import { LineNav } from "@/components/line-nav"
const groups = [ { title: "Crazy Hero", href: "#crazy-hero", items: [ { title: "Vercel Liquid simulation", href: "#vercel-liquid" }, { title: "Ascii Simulation", href: "#ascii-simulation" }, ], }, { title: "OG NavBars", href: "#og-navbars", items: [ { title: "Nike menu", href: "#nike-menu" }, { title: "Apple Navbar V001", href: "#apple-navbar-v001" }, ], },]
export function GroupedExample() { return <LineNav groups={groups} activeHref="#nike-menu" />}

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

PropTypeDefaultDescription
itemsLineNavItem[]undefinedFlat array of navigation items { title, href }.
groupsLineNavGroup[]undefinedCategorized groups { title, href?, items }.
activeHrefstringundefinedControlled active item href.
defaultActiveHrefstringFirst item hrefUncontrolled initial active item href.
sublineCountnumber2Number of intermediate tick marks between entries.
scrollActiveIntoViewbooleantrueScroll active item into view on mount.
onItemClick(item, event) => voidundefinedCallback fired when an item or group header is clicked.
onActiveChange(href: string) => voidundefinedCallback fired when the active href changes.

Command Palette

Quick search and commands navigation