> For the complete documentation index, see [llms.txt](https://partners.tray.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://partners.tray.com.br/themes/construindo-seu-template/referencias/componentes/menu-de-categorias-em-3-niveis.md).

# Menu de Categorias em 3 Níveis

Snippet para criar um menu de categorias, exibindo os 3 níveis.

```html
{#
# Listagem de categorias com 3 níveis
# elements/snippets/list_categories_thirdlvl.html
#}
<ul class="first-lvl">
    {% for category in categories %}
        {% if loop.index <= limit or not limit %}
            <li>
                <a href="{{ category.link }}">{{ category.name }}</a>
                {% if category.children  %}
                  <ul class="second-lvl">
                    {% for child in category.children %}
                        <li>
                             <a href="{{ child.link }}">{{ child.name }}</a>
                             {% if child.children  %}
                                {% for child in child.children %}
                                    <ul class="third-lvl">
                                        <li>
                                             <a href="{{ child.link }}">{{ child.name }}</a>
                                        </li>
                                    </ul>
                                {% endfor %}
                            {% endif %}
                        </li>
                    {% endfor %}
                  </ul>
                {% endif %}
            </li>
        {% endif %}
    {% endfor %}
</ul>
```

### Como usar <a href="#ir-para" id="ir-para"></a>

Copie o código acima e crie um arquivo separado, ex: `elements/snippets/list_categories_thirdlvl.htmtw`\
\
Faça a chamada desse arquivo onde desejar:

```twig
{% element('snippets/list_categories_thirdlvl') %}
```
