> For the complete documentation index, see [llms.txt](https://docs.fact-finder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fact-finder.com/webcomponents-overview/web-components-4.x./api/more-features/similar-products.md).

# Similar Products

Display products similar to selected records through the Similar Products API.

## Documentation

### Overview

Use `ff-similar-products` to display a record list of products similar to another product.

{% hint style="warning" %}
Define field roles before using `ff-similar-products`.
{% endhint %}

Use an `ff-record-list` inside the element. `ff-similar-products` injects records returned by the Similar Products API.

```html
<ff-similar-products>
    <div class="similarProductsHeader">Similar Products</div>

    <ff-record-list>
        <ff-record>
            <img data-image>
            <div>
                <a href="https://www.bergfreunde.de/{{record.Deeplink}}" data-action="redirect">
                    {{record.Title}}
                </a>
                <div>Price: <strong>{{record.Price}} €</strong></div>
            </div>
        </ff-record>
    </ff-record-list>
</ff-similar-products>
```

### Attributes

**record-id**

Set `record-id` to request similar products for that record.

```html
<script>
    const similarProductsElement = document.querySelector("ff-similar-products");
    // Triggers the similar-products service.
    similarProductsElement.recordId = "123456789";
</script>

<ff-similar-products max-results="4" record-id="123456789">
    <!-- ... -->
</ff-similar-products>
```

**max-results**

`max-results` defines how many records load. It defaults to `4`.

```html
<ff-similar-products max-results="4">
   <!-- ... -->
</ff-similar-products>
```

## Demo

Try the [Similar Products demo](https://search-web-components.fact-finder.de/demos/4.x/ff-similar-products).

## API code

### Properties

*(`*` - required, `†` - conditionally required)*

<details>

<summary>Properties</summary>

| Name                                                       | Description                                                                                                                                                              |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **record-id**`*` (Number)                                  | The record ID of the product, for which similar products are returned. This also works for multiple products. In this case the record IDs have to be separated with `,`. |
| **id-type**`†` (String) **Options**: "id", "productNumber" | This attribute determines the type of `record-id`. It is mandatory when using FactFinder NG.                                                                             |
| **max-results** (Number) (default: 4)                      | The maximum amount of returned similar products.                                                                                                                         |

</details>

### Methods

<details>

<summary>Methods</summary>

| Name                     | Description                          |
| ------------------------ | ------------------------------------ |
| **getSimilarProducts()** | Calls up the similar products again. |

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fact-finder.com/webcomponents-overview/web-components-4.x./api/more-features/similar-products.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
