Componentnavigation0.79 KB gzipZero dependencies
Anchor Nav
Sticky section anchor nav with IntersectionObserver spy.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add anchor-navOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { AnchorNav } from "@/components/ui/anchor-nav"; <AnchorNav />Source code
anchor-nav.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| items | AnchorNavItem[] | Structured list of items rendered by the component. (Default: []) |
| activeId | string | Active section tracking via IntersectionObserver |