Files
The <Files> component creates visual file tree structures with expandable folders and nested files. Use it to show project structures, directory layouts, or any hierarchical file organization in your documentation.
The component consists of three parts: <Files> as the container, <Folder> for directories, and <File> for individual files.
Usage
Variants
Nested folders
You can nest folders within folders to create deep directory structures. The component automatically adds visual nesting lines to show the hierarchy.
Linked files and folders
Add the href property to make files or folders clickable. This is useful for linking to documentation pages, GitHub repositories, or other resources. Files and folders with the href property are underlined.
Default open folders
Use the defaultOpen property to have specific folders expanded when the page loads. This is useful for highlighting important directories or showing the most relevant parts of a file structure.
Line highlighting and comments
Use the highlighted property to highlight specific files or folders with an accent background color. Use the comment property to add explanatory text that appears next to an item. These properties are useful for drawing attention to important files or providing additional context, similar to how code blocks support line highlighting and inline comments.
Properties
<Files> properties
The file tree content. Should contain <Folder> and <File> components.
Optional CSS class name for custom styling.
<Folder> properties
The folder name to display.
Whether the folder should be expanded when the page loads. If not specified, the folder will be collapsed by default.
The nested content within the folder. Can include <File> and other <Folder> components.
Optional URL to make the folder name clickable. The name will show an underline when a link is provided.
Whether the line containing the folder should be visually highlighted with an accent background color. Use this to draw attention to important directories.
Optional comment text that appears next to the folder name. Comments are automatically prefixed with # if not already present and styled in a monospace font with muted color.
Optional CSS class name for custom styling.
<File> properties
The file name to display.
Optional URL to make the file name clickable. The name will show an underline when a link is provided.
Whether the line containing the file should be visually highlighted with an accent background color. Use this to draw attention to important files.
Optional comment text that appears next to the file name. Comments are automatically prefixed with # if not already present and styled in a monospace font with muted color.
Optional CSS class name for custom styling.