# Menu de Categorias

Snippet para criar um menu de categorias, exibindo os primeiros e segundos níveis.

```html
{#
# Categories Menu
# elements/snippets/categories_menu.html
#}
 
<ul class="menu">
    {% for category in categories %}
        {% set children = category.children %}
        <li>
            <a href="{{ category.link }}">{{ category.name }}</a>
            {% if children %}
                <ul class="menu-children">
                {% for child in children %}
                    <li>
                        <a href="{{ child.link }}">{{ child.name }}</a>
                    </li>
                {% endfor %}
                </ul>
            {% endif %}
        </li>
    {% endfor %}
</ul>
```

#### Como usar <a href="#exemplo" id="exemplo"></a>

Copie o código acima e crie um arquivo separado, ex: `elements/snippets/categories_menu.html`

Faça a chamada desse arquivo onde desejar:

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://partners.tray.com.br/themes/construindo-seu-template/referencias/componentes/menu-de-categorias.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
