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
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>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>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>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>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>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>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
Try the Filter Cloud demo.
API code
ff-filter-cloud
Properties
Events
Last updated
Was this helpful?