Arihant jain

Tree Nav

Navigation 100

About

A vertical navigation list with a tree-style rail and a spring-animated marker that glides to follow hover and settles on the active link.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Tree Nav to your project and fits it to your theme.

Code

How Tree Nav is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import { TreeNav } from "@/components/ui/tree-nav";

const ITEMS = [
  { label: "Overview", href: "#overview" },
  { label: "Installation", href: "#installation" },
  { label: "Usage", href: "#usage" },
  { label: "Theming", href: "#theming", badge: "New" },
  { label: "Accessibility", href: "#accessibility" },
  { label: "Changelog", href: "#changelog" },
];

export default function TreeNavDemo() {
  const [active, setActive] = React.useState(ITEMS[0].href);

  return (
    <div className="flex w-full justify-center py-8">
      <TreeNav
        className="w-full max-w-[240px]"
        items={ITEMS}
        activeHref={active}
        onSelect={(item, event) => {
          event.preventDefault();
          setActive(item.href);
        }}
      />
    </div>
  );
}

Dependencies

More by Arihant jain

View all
  • Footer section

    Footer section

    1.9K
  • Multistep Form

    Multistep Form

    710
  • Animated Drawer

    Animated Drawer

    694
  • Status Badge

    Status Badge

    514
  • Stacked Circular Footer

    Stacked Circular Footer

    426
  • Input Modal

    Input Modal

    330
  • Large Name Footer

    Large Name Footer

    199
  • Profile Dropdown

    Profile Dropdown

    196

More in Navigation

View all
  • Sidebar

    Sidebar

    286
  • Navbar

    Navbar

    1
  • Tabs

    Tabs

    34
  • Oversized 404 Numeral

    Oversized 404 Numeral

    57
  • Sidebar

    Sidebar

    348
  • Breadrcrumb

    Breadrcrumb

    8
  • Pagination

    Pagination

    91
  • Pagination

    Pagination

    15

Explore more

Part of Spectrum UI — browse the full library on 21st.dev.