trees

Use when an app uses @pierre/trees to render or control a file tree, including React, vanilla JavaScript, SSR, web components, selection, search, rename, drag and drop, icons, git status, and themes.

Install
npx skills add 'https://github.com/pierrecomputer/pierre/tree/main/skills/trees'
Download bundle ↓
main · 1831817Scanned 2026-09-15

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md

Recipe: use a file tree in vanilla JavaScript

Create the model and mount it in an element with a height:

import { FileTree } from '@pierre/trees';

const mount = document.querySelector<HTMLElement>('#files');
if (mount == null) throw new Error('Missing file tree mount');

mount.style.height = '320px';

const tree = new FileTree({
  paths: ['README.md', 'src/', 'src/index.ts'],
  initialExpansion: 'open',
  search: true,
});

tree.render({ containerWrapper: mount });

Use add, remove, move, or resetPaths to update paths. Call cleanUp() when the host removes the tree.

Referenced from SKILL.md