Componentnavigation0.79 KB gzipZero dependencies

Anchor Nav

Sticky section anchor nav with IntersectionObserver spy.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add anchor-nav

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { AnchorNav } from "@/components/ui/anchor-nav"; <AnchorNav />

Source code

anchor-nav.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxanchor-nav.tsx68 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface AnchorNavItem {  id: string;  label: string;} export interface AnchorNavProps extends React.HTMLAttributes<HTMLElement> {  items: AnchorNavItem[];  /** Active section tracking via IntersectionObserver */  activeId?: string;} /** Fixed section anchor links: vertical line + active indicator dot. */export function AnchorNav({ items = [], activeId, className, ...props }: AnchorNavProps) {

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { AnchorNav } from "@/components/ui/anchor-nav"; <AnchorNav />
PropTypeDescription
itemsAnchorNavItem[]Structured list of items rendered by the component. (Default: [])
activeIdstringActive section tracking via IntersectionObserver