Map

@pierre/trees

Toolbox toolboxtypescriptreactwebdeveloper-toolsTypeScriptApache-2.0 โ†ณ show in map Markdown
title
@pierre/trees
type
toolbox
summary
File-tree renderer for the web with a path-first model, virtualized for very large trees
tags
typescript, react, web, developer-tools
language
TypeScript
license
Apache-2.0
created
2026-07-21
updated
2026-07-21

An open-source file-tree rendering library for the web, from The Pierre Computer Co., built for extreme performance on large trees. Like its sibling @pierre/diffs (same pierrecomputer/pierre monorepo), it offers both React and vanilla-JS APIs with SSR support and heavy theming โ€” the file-explorer counterpart to the diff/code renderer.

The model: path-first

The organizing idea is a path-first identity model. Items are identified by their path, and the API is built around that shared model across both integrations. You feed it tree data (paths, or a "prepared input" form for speed), and it handles selection, focus, keyboard navigation, search, rename, drag-and-drop, and git-status annotations. The docs push you toward prepared (and presorted prepared) input for large trees โ€” precomputing the shape so rendering stays cheap โ€” which is where the "extreme performance on large trees" claim comes from, together with virtualization.

What's in it

  • React quickstart โ€” useFileTree hook, FileTree component, selector hooks, and prepared input.
  • Vanilla quickstart โ€” new FileTree, render, imperative model methods, and prepared input.
  • Navigation โ€” selection, focus, keyboard movement, and a configurable fileTreeSearchMode.
  • Mutation โ€” inline rename, drag-and-drop, and optional context-menu / item-action workflows.
  • Git status & row annotations โ€” built-in gitStatus signals plus custom row decorations (badges, colors) per item.
  • Icons โ€” built-in icon sets, remaps, color modes, and a sprite-sheet extension mechanism (FileTreeIconConfig, remap precedence).
  • Virtualization โ€” settings tuned for large trees so only visible rows render.
  • SSR โ€” preloadFileTree on the server, serializeFileTreeSsrPayload, and React/vanilla hydration with an opaque SSR handoff.

Styling and theming

Host styling plus CSS-variable families with a defined fallback precedence, theme helpers (themeToTreeStyles), and an unsafeCSS escape hatch โ€” the same theming philosophy as pierre-diffs.

Usage

npm install @pierre/trees
import { useFileTree, FileTree } from "@pierre/trees/react";

const tree = useFileTree({ files: preparedInput });
<FileTree tree={tree} />

Vanilla JS constructs new FileTree(...), calls render, and drives it through imperative methods and subscriptions.

Notes

  • Package @pierre/trees is at v1.0.0-beta.x โ€” younger than @pierre/diffs (v1.2.x) and still pre-stable. Apache-2.0.
  • Part of the broader pierrecomputer/pierre monorepo (~5.5kโ˜… across all of Pierre's open-source code).
  • Docs: trees.software/docs (with llms.txt / llms-full.txt).
  • pierre-diffs โ€” the sibling diff/code renderer; the two compose into a full code-review UI (file tree + diffs)
  • developer-icons โ€” comparable developer-UI primitive library in the toolbox