# Showcase ( List / Grid )

Snippet para exibir os produtos da pagina catalogo em forma de lista ou grid

{% tabs %}
{% tab title="HTML" %}

```html
{#
  # Showcase (List/Grid)
  # elements/snippets/showcase_catalog.html
#}
<div id="wrap-list">
  <span id="list" class="list">
    <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 494.999 494.999"><path d="M105.031 119.481h284.938c32.988 0 59.742-26.743 59.742-59.741C449.71 26.743 422.957 0 389.968 0H105.031C72.043 0 45.289 26.743 45.289 59.74c0 32.998 26.754 59.741 59.742 59.741zM389.968 187.757H105.031c-32.987 0-59.742 26.747-59.742 59.744 0 32.994 26.755 59.741 59.742 59.741h284.938c32.988 0 59.742-26.747 59.742-59.741-.001-32.997-26.754-59.744-59.743-59.744zM389.968 375.518H105.031c-32.987 0-59.742 26.747-59.742 59.741 0 32.997 26.755 59.74 59.742 59.74h284.938c32.988 0 59.742-26.743 59.742-59.74-.001-32.994-26.754-59.741-59.743-59.741z"/></svg>
  </span>
  <span id="grid" class="grid">
    <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><path d="M10.75 15A2.25 2.25 0 0 1 13 17.25v5.5A2.25 2.25 0 0 1 10.75 25h-5.5A2.25 2.25 0 0 1 3 22.75v-5.5A2.25 2.25 0 0 1 5.25 15h5.5Zm12 0A2.25 2.25 0 0 1 25 17.25v5.5A2.25 2.25 0 0 1 22.75 25h-5.5A2.25 2.25 0 0 1 15 22.75v-5.5A2.25 2.25 0 0 1 17.25 15h5.5Zm-12-12A2.25 2.25 0 0 1 13 5.25v5.5A2.25 2.25 0 0 1 10.75 13h-5.5A2.25 2.25 0 0 1 3 10.75v-5.5A2.25 2.25 0 0 1 5.25 3h5.5Zm12 0A2.25 2.25 0 0 1 25 5.25v5.5A2.25 2.25 0 0 1 22.75 13h-5.5A2.25 2.25 0 0 1 15 10.75v-5.5A2.25 2.25 0 0 1 17.25 3h5.5Z" /></svg>
  </span>
</div>
{% if products|length > 0 %}
  <div class="row">
    {% for product in products %}
      <div class="col-sm-4 grid product">
        {% element 'snippets/product' {"product": product} %}
      </div>
    {% endfor %}
  </div>
{% endif %}
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
$(function(){
    $('#list').click(function(){
          $('.product').removeClass('col-sm-4 grid');
          $('.product').addClass('col-md-12 list');
    });

    $('#grid').click(function(){
          $('.product').removeClass('col-md-12 list');
          $('.product').addClass('col-sm-4 grid');
    });
});
```

{% endtab %}
{% endtabs %}

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

Copie o bloco de código ***HTML*** e crie um arquivo separado, ex: elements/snippets/showcase\_catalog.html

Abra o arquivo `pages/catalog.html` e substitua o bloco de código abaixo:

```twig
{% element 'snippets/showcase' {
  "products": products
} %}
```

Por:

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

Copie o bloco de código ***JAVASCRIPT*** e cole em seu arquivo `.js`


---

# 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/showcase-list-grid.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.
