# Haml Components

Another way to reuse your existing views and partials are components with *\*.haml* templates. You can create a component and don't implement a `response` method. In this case, Matestack will look for a *\*.haml* file right next to it. In this *\*.haml* file you can access all variables, methods, helpers and so on which you could access in a component. Let's take a closer look by recreating our product teaser component with a *\*.haml* file. We create a file called `teaser_haml.rb` in `app/matestack/components/products/`.

```ruby
class Components::Products::TeaserHaml < Matestack::Ui::Component

  requires :product

end
```

Next we create the corresponding *\*.haml* template. As said above, Matestack looks for this template next to the component file. So we will create it in `app/matestack/components/products/teaser_haml.haml`.

```
= link_to product_path(product), class: 'product-teaser' do
  %div
    %h2= product.name
    %p= product.description
    %b= product.price
```

After registering this component we can use it on Rails views with `matestack_component`. This gives you the opportunity to reuse your views, part of them or partials easily by creating a component and moving your view markup into a *\*.haml* file next to it. If you are not already using haml in your project checkout [html2haml](https://github.com/haml/html2haml) or many of the available online tools to convert your erb views effortless into *\*.haml* views.


---

# 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://docs.matestack.io/matestack-ui-core/1.5.0/ui-components/haml-components.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.
