RangeFacet
This topic describes the anatomy, API reference, and variations of the RangeFacet primitive component.
Anatomy
import { RangeFacet } from '@sitecore-search/ui';
const MyRangeSliderComponent = () => (
<RangeFacet.Root>
<RangeFacet.Track>
<RangeFacet.Range />
</RangeFacet.Track>
<RangeFacet.Start />
<RangeFacet.End />
</RangeFacet.Root>
);Using the component
This section describes use of the RangeFacet primitive component. You can copy and paste the code blocks into your React application.
() => {
const { StyledRoot, AccordionTrigger, FacetStyled, StyledThumb, StyledStart, StyledEnd, StyledRange, StyledTrack } =
buildStoryComponents();
return (
<>
<AccordionFacets.Root>
<FacetStyled facetId="facetId3">
<AccordionTrigger>Price</AccordionTrigger>
<AccordionFacets.Content>
<StyledRoot defaultValue={DEFAULT_VALUE} min={0} max={100} steps={1}>
<StyledTrack>
<StyledRange />
</StyledTrack>
<StyledStart>{(value) => <span>{value}</span>}</StyledStart>
<StyledEnd>{(value) => <span>{value}</span>}</StyledEnd>
</StyledRoot>
</AccordionFacets.Content>
</FacetStyled>
</AccordionFacets.Root>
</>
);
}API Reference
RangeFacet.Root
The RangeFacet.Root component contains all the parts of an accordion.
|
Name |
Description |
|---|---|
|
|
The children inner to the |
|
|
Number The minimum value that the slider can support. |
|
|
Number The maximum value that the slider can support. |
|
|
Array of numbers. The value of the slider when initially rendered. |
|
|
Number The stepping interval. |
|
|
Boolean Default: Adjust the limits according to min and max values |
RangeFacet.Track
The RangeFacet.Track component contains the RangeFacet.Range.
RangeFacet.Range
The range part. Must live inside RangeFacet.Track.
RangeFacet.Start
The RangeFacet.Start is the draggable thumb for the starting point. Receives a function that has the value as parameter and returns the layout content.
<RangeFacet.Start>{(value) => <span>{value}</span>}</RangeFacet.Start>RangeFacet.End
The RangeFacet.End is the draggable thumb for the end point. Receives a function that has the value as parameter and returns the layout content.
<RangeFacet.End>{(value) => <span>{value}</span>}</RangeFacet.End>