UI libraries / InstantSearch.js / Widgets

For now, this widget is only available in Recommend.js v1.

About this widget

The trendingFacets widget isn’t available in InstantSearch.js. If you need to use it, please use the trendingFacets function from the deprecated Recommend JS library.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/** @jsx h */
import { h } from 'preact';
import { trendingFacets } from '@algolia/recommend-js';
import { recommendClient as recommend } from '@algolia/recommend';

const recommendClient = recommend('YourApplicationID', 'YourSearchOnlyAPIKey');
const indexName = 'YOUR_INDEX_NAME';
const facetName = 'YOUR_FACET_NAME';

trendingFacets({
  container: '#trendingFacets',
  recommendClient,
  indexName,
  facetName,
  itemComponent({ item }) {
    return (
      <pre>
        <code>{JSON.stringify(item)}</code>
      </pre>
    );
  },
});
Did you find this page helpful?