---
title: "Facets"
slug: "facets"
abstract: "Using facet objects in the Sitecore Search JS SDK to a request to narrow results for a keyphrase."
---
# Facets

In Sitecore Search, you can use [facets to classify your content](https://doc.sitecore.com/search/en/users/search-user-guide/refine-search-results.html). Facet values can be a string, a number, or a range. Often facets are displayed in the UI as part of the search experience.

To narrow results in a search results widget, you need to include the facets model or `SearchResultsConfig` and values for selected facets or array of `SearchResultsStoreSelectedFacet`.

## SearchResultsConfig and facets

This object describes configuration for the search request and results, and is included in the `useSearchResults` [query hook](https://doc.sitecore.com/search/en/developers/search-js-sdk-for-react/js-sdk-reference/query-hooks/usesearchresults.html "useSearchResults"). You need to include a `SearchResultsFacetConfigItem` object in its `facets` value to configure how the facet is handled. By default, facets are compared using *valueId*.

| Property | Type | Description |
| --- | --- | --- |
| `facets` | SearchResultsStoreSelectedFacets | Object of key-value pairs where the keys are the facet name and the values are `SearchResultsFacetConfigItem` objects. |

> [!note]
> Refer to the Sitecore Search interface for attribute names.

### SearchResultsFacetConfigItem

| Property | Type | Description | Values |
| --- | --- | --- | --- |
| `type` | FacetPayloadType | Required.<br><br>Describes the type of payload. | Default: *valueId*<br><br>*text*<br><br>*rage* |

## SearchResultsStoreSelectedFacet

The `state` object in `useSearchResults` contains the `selectedFacets` attribute, which is an array of `SearchResultsStoreSelectedFacet` objects that include `SearchResultsStoreValueIdSelectedFacet`, `SearchResultsStoreRangeSelectedFacet`, and `SearchResultsStoreTextSelectedFacet`.

### SearchResultsStoreTextSelectedFacet

Extends `BaseSearchResultsStoreSelectedFacet`

| Property | Type | Description |
| --- | --- | --- |
| `facetValueText` | string | Required.<br><br>Text associated with the facet. |
| `facetValueId` | string | ID associated with the facet value. |

### SearchResultsStoreValueIdSelectedFacet

Extends `BaseSearchResultsStoreSelectedFacet`

| Property | Type | Description |
| --- | --- | --- |
| `facetValueId` | string | Required.<br><br>ID associated with the facet value. |

### SearchResultsStoreRangeSelectedFacet

Extends `BaseSearchResultsStoreSelectedFacet`

| Property | Type | Description |
| --- | --- | --- |
| `min` | number | Minimum facet value. |
| `max` | number | Maximum facet value. |

### BaseSearchResultsStoreSelectedFacet

This is the base type for selected facet objects.

| Property | Type | Description |
| --- | --- | --- |
| `facetId` | number | Required.<br><br>ID associated with the facet. |
| `facetLabel` | string | Display label associated with facet. |
| `valueLabel` | string | Display label associated with facet value. |