Skip to main content

About this widget

The trendingFacets widget isn’t part of InstantSearch.js. If you need it, use the trendingFacets function from the deprecated Recommend JS library.

Examples

JavaScript
/** @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>
    );
  },
});
⌘I