File tree
Display directory structures as visual file trees using the FileTree component.
The <FileTree> component renders a nested markdown list as a visual directory tree, complete with file and folder icons. Use it to show project layouts, configuration structures, or any hierarchical file system.
Basic usage
Write a nested markdown list inside <FileTree>. Items ending with / become folders; all others are treated as files.
<FileTree>- src/ - pages/ - index.astro - components/ - Header.astro - Footer.astro- astro.config.ts- package.json</FileTree>- src/
- pages/
- index.astro
- components/
- Header.astro
- Footer.astro
- pages/
- astro.config.ts
- package.json
Highlighting a file
Wrap a filename in **bold** to highlight it in accent color — useful for pointing out which file is being discussed.
<FileTree>- src/ - pages/ - **[...slug].astro** - index.astro- **astro.config.ts**</FileTree>- src/
- pages/
- […slug].astro
- index.astro
- pages/
- astro.config.ts
Omitting content
Use ... as a list item to indicate that some entries have been left out for brevity.
<FileTree>- content/ - docs/ - en/ - getting-started/ - installation.mdx - ... - fr/ - ...</FileTree>- content/
- docs/
- en/
- getting-started/
- installation.mdx
- …
- getting-started/
- fr/
- …
- en/
- docs/
Dustavez project structure
Here is the full structure of a fresh Dustavez project:
- content/
- docs/
- en/
- getting-started/
- authoring/
- theming/
- api-reference/
- deployment/
- en/
- docs/
- src/
- components/
- mdx/
- layouts/
- DocsLayout.astro
- lib/
- i18n.ts
- navigation.ts
- pages/
- […slug].astro
- index.astro
- styles/
- tokens.css
- content.config.ts
- components/
- astro.config.ts
- package.json
FileTree takes no props — all structure comes from the nested list in the slot. Nest as deeply as needed; indentation determines the hierarchy.