Malay Patel

Tree View

Component

About

A file and folder tree with folders that ease open, guide lines, a sliding selection and full tree keyboard control. Free component from uibrik (uibrik.com).

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

Code

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

Usage.tsx

"use client";

import { TreeView, type TreeNode } from "@/components/ui/tree-view";

const DATA: TreeNode[] = [
  {
    name: "app",
    children: [
      { name: "dashboard", children: [{ name: "page.tsx" }, { name: "loading.tsx" }] },
      { name: "layout.tsx" },
      { name: "page.tsx" },
      { name: "globals.css" },
    ],
  },
  {
    name: "components",
    children: [{ name: "ui", children: [{ name: "button.tsx" }, { name: "dialog.tsx" }, { name: "tooltip.tsx" }] }, { name: "header.tsx" }],
  },
  { name: "lib", children: [{ name: "utils.ts" }] },
  { name: "public", children: [{ name: "logo.svg" }, { name: "og.png" }] },
  { name: "package.json" },
  { name: "README.md" },
  { name: "tsconfig.json" },
];

const { expandAll, ...props } = {
  guides: true,
  indent: 16,
  expandAll: false,
};

export default function Demo() {
  return (
    <div className="flex h-screen w-full items-center justify-center px-4">
      <div className="w-full max-w-[280px] rounded-2xl bg-background p-2 shadow-[inset_0_0_0_1px_var(--border)]">
        <TreeView
          {...props}
          data={DATA}
          defaultExpanded={expandAll ? "all" : ["app", "app/dashboard"]}
          defaultSelected="app/dashboard/page.tsx"
        />
      </div>
    </div>
  );
}

Dependencies

More by Malay Patel

View all
  • Halftone

    Halftone

    48
  • Balloon Button

    Balloon Button

    33
  • Fold Toolbar

    Fold Toolbar

    31
  • Hold To Confirm

    Hold To Confirm

    14
  • Marquee

    Marquee

    9
  • Aurora

    Aurora

    6
  • Otp Input

    Otp Input

    5
  • Copy Button

    Copy Button

    4