Skip to contentGet lifetime access

Components

File Tree

Installation

Requires a Planes Pro license.

Works once the @useplanes registry is set up in your project (one-time). After that, copy and run commands directly.

pnpm dlx shadcn add @useplanes/file-tree

Unlock with Planes Pro

$129 once · 231 Pro components · lifetime updates.

import { FileTree } from "@/components/ui/FileTree";

<FileTree
  defaultItems={[
    { id: "app", name: "app", children: [
      { id: "app/layout.tsx", name: "layout.tsx" },
      { id: "app/page.tsx", name: "page.tsx" },
    ] },
    { id: "public", name: "public", children: [] },
    { id: "package.json", name: "package.json" },
  ]}
  defaultExpanded={["app"]}
  onItemsChange={(items, move) => saveTree(items, move)}
  onValueChange={(id) => openFile(id)}
/>

Examples

Set up UI SDK

The behavior comes from UI SDK, which needs React 19 and one line at the top of your global stylesheet so your own classes win over its small built-in styles.

@layer ui-sdk;
@import "tailwindcss";

Save moves to your backend

Keep the tree in your own state and persist each move. Leave `items` unchanged to refuse one.

const [items, setItems] = useState(initialItems);

<FileTree
  items={items}
  onItemsChange={(next, move) => {
    setItems(next);
    void fetch("/api/files/move", { method: "POST", body: JSON.stringify(move) });
  }}
/>

Use cases

  • Docs and CMS sidebars

    Let editors reorder pages and move them between sections without a separate settings screen.

  • File and asset managers

    Drag uploads into folders, with a keyboard path that does the same thing.

  • Project and settings navigation

    A nested outline people can arrange to match how they work.