nikolas-sapa

Tree Hinge Fold

Navigation

About

A keyboard-navigable file/folder tree view where each expanding branch swings open like a carpenter's folding rule around a hinged pivot, with rows unfolding in sequence and collapsing faster than they open.

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

Code

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

Usage.tsx

"use client";

import { FoldingRule, type RuleNode } from "@/components/ui/tree-hinge-fold";

const nodes: RuleNode[] = [
  {
    id: "src",
    label: "src",
    children: [
      {
        id: "components",
        label: "components",
        children: [
          { id: "button", label: "button.tsx" },
          { id: "dialog", label: "dialog.tsx" },
          { id: "tabs", label: "tabs.tsx" },
        ],
      },
      { id: "lib", label: "lib" },
      { id: "index", label: "index.ts" },
    ],
  },
  { id: "scripts", label: "scripts" },
  { id: "package", label: "package.json" },
  { id: "readme", label: "README.md" },
];

export default function TreeHingeFoldDemo() {
  return (
    <div className="flex min-h-[420px] w-full items-center justify-center bg-background p-10">
      <div className="w-full max-w-sm rounded-lg border border-border bg-surface p-4">
        <FoldingRule nodes={nodes} defaultExpanded={["src", "components"]} />
      </div>
    </div>
  );
}

More by nikolas-sapa

View all
  • Dye Whorl

    Dye Whorl

    139
  • Countdown Vapor Digits

    Countdown Vapor Digits

    122
  • Hero Burin Hatch

    Hero Burin Hatch

    62
  • Background ASCII Wake

    Background ASCII Wake

    55
  • Hero Text Ring Funnel

    Hero Text Ring Funnel

    48
  • Toast Gravity Stack

    Toast Gravity Stack

    46
  • Hero ASCII Schlieren

    Hero ASCII Schlieren

    45
  • Hero ASCII Reaction Front

    Hero ASCII Reaction Front

    41

More in Navigation

View all
  • Sidebar

    Sidebar

    235
  • Navbar with Theme Toggle

    Navbar with Theme Toggle

    43
  • Sidebar

    Sidebar

    339
  • Tabs

    Tabs

    60
  • Numberless Pagination with Text

    Numberless Pagination with Text

    11
  • Oversized 404 Numeral

    Oversized 404 Numeral

    50
  • Footer

    Footer

    446
  • Pagination

    Pagination

    43