File tree
A directory listing with selectable names and real file icons, instead of ASCII art in a code fence.
- #authoring
- #components
- #filesystem
Hierarchy here comes from directory paths, so entries describe layouts often. A tree drawn with box characters inside a code fence is an image of a structure: a screen reader reads the box characters, and the names cannot be selected without dragging in the pipes.
<FileTree> renders the same thing as a list. Names are text, nesting is
nesting, and each row picks its own icon from its name, using the Material Icon
Theme glyphs VS Code uses, so a .mdx and a .ts are distinguishable without
reading them.
- README.mdxthe entry document
- use-debounce.tsserved as-is
- debounce-diagram.svg
- package.json
- biome.json
Marking the subject
highlight marks the node the surrounding prose is about, and comment adds a
short trailing note. Both are for the one or two rows that matter; a tree with
every row highlighted has marked nothing.
A folder opens by default. defaultOpen={false} collapses a branch that is
there for context, meaning the shape of the parent, rather than for reading.
Props
<Folder /> and <File />
namestring
The file or directory name. The icon is chosen from it.
highlight?boolean
Marks the node as the subject of the surrounding prose.
- Default
false
comment?string
Short trailing note, in plain text.
defaultOpen?boolean
Folder only. Collapses a branch kept for context.
- Default
true
Related entries
Callouts
Semantic notices for a caveat, a tip or a danger, with the five types and when each is honest.
Steps
A numbered procedure whose rail survives the code blocks inside it.
Tabs
One panel per alternative, with keyboard navigation and a shared choice across the document.