Skip to content

New Feature: Support complex non-string labels for facets. #507

@damontgomery

Description

@damontgomery

We would like to display StandardFacet labels using React components.

Example

We have a ratings facet that uses stars instead of text labels. We have these as React components and would like to re-use them.

Current options

The transformOptions property allows us to modify the facet options, but the displayName must be a string.

export declare interface DisplayableFacetOption extends FacetOption {
    /** The name of the facet option which is meant  to be displayed to the end user. */
    displayName: string;
    /** The number of results associated with this facet option. */
    count: number;
    /** Whether or not the filter is selected in the search results. */
    selected: boolean;
}

For now, we have created our own components that mimic the StandardFacet component using the hooks directly.

However, when using Facets, we cannot order our custom facets between those rendered by the Facets component. So, we display them at the top or bottom next to the Facets component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions