For the complete documentation index, see llms.txt. This page is also available as Markdown.

Filter Cloud

Display and manage selected filters with customizable templates.

Documentation

Filter Cloud displays all filters that are currently selected. In its templates, it provides the related Facet and the selected FacetElement.

Specifying templates

1

Add the Filter Cloud

You can use ff-filter-cloud by adding one line to your HTML code:

<ff-filter-cloud></ff-filter-cloud>

A default template will be applied to all filters:

<span data-template="filter">{{element.text}}</span>
2

Rendered HTML

When set up like in the example above, the rendered HTML could look like this:

<ff-filter-cloud>
    <span data-template="filter">Element 1</span>
    <span data-template="filter">Element 2</span>
    <span data-template="filter">Element 3</span>
    <span data-template="filter">Element 4</span>
</ff-filter-cloud>
3

Customize filter element appearance

To customize filter element appearance, you can add an HTML element annotated with data-template="filter". You can access the facet's display name through {{facet.name}}:

<ff-filter-cloud>
    <span data-template="filter">{{facet.name}}: {{element.text}}</span>
</ff-filter-cloud>
4

Rendered HTML

When set up like in the example above, the rendered HTML could look like this:

<ff-filter-cloud>
    <span data-template="filter">Group 1: Element 1</span>
    <span data-template="filter">Group 2: Element 2</span>
    <span data-template="filter">Group 3: Element 3</span>
    <span data-template="filter">Group 4: Element 4</span>
</ff-filter-cloud>
5

Add custom HTML

A custom filter template can be used with some additional custom HTML.

<ff-filter-cloud>
    <h4>The Filter Cloud</h4>

    <div>
        <div>Custom above</div>

        <div data-template="filter" class="filter-element">
            <span>{{facet.name}}: {{element.text}}</span><span> ×</span>
        </div>

        <div>Custom below</div>
  </div>
</ff-filter-cloud>
6

Rendered HTML

When set up like in the example above, the rendered HTML could look like this:

<ff-filter-cloud>
    <h4>The Filter Cloud</h4>

    <div>
        <div>Custom above</div>

        <div data-template="filter" class="filter-element">
            <span>Group 1: Element 1</span><span> ×</span>
        </div>
        <div data-template="filter" class="filter-element">
            <span>Group 2: Element</span><span> ×</span>
        </div>
        <div data-template="filter" class="filter-element">
            <span>Group 3: Element 3</span><span> ×</span>
        </div>

        <div>Custom below</div>
    </div>
</ff-filter-cloud>

If no element annotated with data-template="filter" is specified, a console error will be displayed and the component will not render itself.

The only exception where data-template="filter" may be omitted is when ff-filter-cloud is left completely empty.

7

Invalid setup

The following is an error — ff-filter-cloud has no way of determining where to render its filter-item elements.

<ff-filter-cloud>
    <span>Custom HTML</span>
</ff-filter-cloud>

Blacklist

If you want to exclude specific facets from the filter cloud, you can use the blacklist attribute. You may specify as many facets as you need, separated by commas. The values must correspond to the facets's associatedFieldName property returned by FactFinder.

Setup

This example will blacklist all filters applied by the Price and Size facets.

<ff-filter-cloud blacklist="Price,Size">
    <div>
         <span data-template="filter">{{facet.name}}: {{element.text}}</span>
    </div>
</ff-filter-cloud>

Whitelist

If you want to exclusively specify each facet, you can use the whitelist attribute. Like in blacklist, you may specify as many facets as you need, separated by commas. The values must correspond to the facet's associatedFieldName property returned by FactFinder.

Setup

This example will whitelist only filters applied by the Brand and Category facets.

Filter click

There is only one delegated click listener for the filter elements, and it is attached to ff-filter-cloud itself. Click events on filter items bubble up to ff-filter-cloud and are processed there.

By default, clicking on a filter item removes it. You can attach your own click listener and call event.stopPropagation() to prevent default behavior.

See the example below that shows how to create a filter element with a clickable x button:

Demo

API code

ff-filter-cloud

Properties

Properties
Name
Description

blacklist (String)

Comma-separated ASN group names to exclude. Cannot be used with whitelist.

order (String) Options: "alphabetical", "fact-finder", "user-selection" (default: "fact-finder")

Determines the filter order.

whitelist (String)

Comma-separated ASN group names to include exclusively. Cannot be used with blacklist.

Events

Events
Name
Description

dom-updated

Fires after the element receives data and renders its templates.

Last updated

Was this helpful?