Skip to content
Foldocs
On this pageTyped output

Generate a file tree

Turn a real directory into a Foldocs Files component.

bash
pnpm foldocs tree ./src ./content/tree.mdx

The output contains nested Files, Folder, and File components. Directories are listed first and entries are sorted deterministically. Hidden files and node_modules are excluded by default; pass --hidden when they are relevant.

Typed output

An output ending in .tsx receives a serializable BlockComponent tree instead of MDX. This is useful for content adapters and generated documents that operate directly on Foldocs' typed AST.

Last updated Aug 3, 2026