---
title: "Directory tree"
manual: "How to Document"
version: "main"
permalink: "https://docs.typo3.org/permalink/h2document:writing-rest-directory-tree"
source: "Reference/ReStructuredText/Lists/DirectoryTree.rst"
modified: "2026-09-14T09:38:54+00:00"
---

# Directory tree

You can use the directive `.. directory-tree:: ` to make a nested list look like
an expandable directory tree. This is helpful in discussing file structure for
extensions or projects.

## Example: a basic directory tree, two levels expanded

-   EXT:my_sitepackage/Resources/Private/Templates/
    -   Layouts
        -   Default.html
        -   WithoutHeader.html
    -   Pages
        -   Default.html
        -   StartPage.html
        -   TwoColumns.html
        -   With_sidebar.html
    -   Partials
        -   Footer.html
        -   Sidebar.html
        -   Menu.html

**EXT:my_extension/Documentation/SomeDocument.rst**

```rst
..  directory-tree::
    :level: 2
    :show-file-icons: true

    *   EXT:my_sitepackage/Resources/Private/Templates/

        *   Layouts

            *   Default.html
            *   WithoutHeader.html

        *   Pages

            *   Default.html
            *   StartPage.html
            *   TwoColumns.html
            *   With_sidebar.html

        *   Partials

            *   Footer.html
            *   Sidebar.html
            *   Menu.html
```

## Example: a page tree with empty folders

-   `Classes`
-   `Configuration`
    -   `Backend`
    -   `Extbase`
        -   `Persistence`
    -   `TCA`
    -   `TsConfig`
    -   `TypoScript`
    -   `Icons.php`
    -   `page.tsconfig`
    -   `Services.yaml`
    -   `user.tsconfig`
-   `Documentation`
-   `Resources`
    -   `Private`
        -   `Language`
    -   `Public`
-   `Tests`
-   `composer.json`
-   `ext_emconf.php`
-   `ext_localconf.php`
-   `ext_tables.sql`

**EXT:my_extension/Documentation/SomeDocument.rst**

```rst
..  directory-tree::

    *   :path:`Classes`
    *   :path:`Configuration`

        *   :path:`Backend`
        *   :path:`Extbase`

            *   :path:`Persistence`

        *   :path:`TCA`
        *   :path:`TsConfig`
        *   :path:`TypoScript`
        *   :file:`Icons.php`
        *   :file:`page.tsconfig`
        *   :file:`Services.yaml`
        *   :file:`user.tsconfig`

    *   :path:`Documentation`
    *   :path:`Resources`

        *   :path:`Private`

            *   :path:`Language`

        *   :path:`Public`

    *   :path:`Tests`
    *   :file:`composer.json`
    *   :file:`ext_emconf.php`
    *   :file:`ext_localconf.php`
    *   :file:`ext_tables.sql`
```

## Properties

### level

-   **level**

    -   *Type:* int
    -   *Default:* unlimited

    Limit the levels of the tree initially shown expanded.

### show-file-icons

-   **show-file-icons**

    -   *Type:* bool
    -   *Default:* false

    Display a folder icon beside each entry that has a sub-entry, a file icon
    otherwise.
