Histogram Slider
ProA range slider with the distribution of the data drawn over it, so a price or date filter shows where the values fall before anyone drags.
$60 to $280
241 homes
Installation#
Usage#
Count your items into equal slices of the scale and pass them as bins. Everything else is a Slider range.
The preview is yours to explore. Its code comes with a Pro license, paid once and used in every project.
Have a license? Unlock it here
Sizes#
size sets the height of the bars and the slider under them.
Variants#
variant tints the range and the bars inside it, so the two read as one selection. Bars outside it stay neutral.
Accessibility#
The bars are decorative and hidden from assistive tech; the two thumbs carry the meaning. Give the slider an aria-label and each thumb reads it with “start” or “end” added. Both thumbs follow the arrow keys, Page Up and Page Down, Home and End.
API reference#
HistogramSlider
A row of bars over a two-thumb Slider. Forwards the Slider props except orientation, inverted, marks and shape; className is merged last on the wrapper.
| Prop | Type | Default | Description |
|---|---|---|---|
| bins | number[] | - | How many items fall in each equal slice of min to max, in order. |
| value | number[] | - | The controlled range, two values. Pair with onValueChange. |
| defaultValue | number[] | - | The initial range when uncontrolled. Defaults to the whole scale. |
| onValueChange | (value: number[]) => void | - | Fires on every change while dragging or stepping. |
| min | number | 0 | The lowest value. |
| max | number | 100 | The highest value. |
| size | "sm" | "md" | "lg" | "md" | Bar height (48, 64 or 80px) and the size of the slider. |
| variant | "default" | "brand" | "success" | "warning" | "destructive" | "default" | Tints the range and the bars inside it. |
| tooltip | boolean | true | Shows a value bubble above each thumb. |
| formatValue | (value: number) => React.ReactNode | - | Formats the bubble value. |
| Data attribute | Description |
|---|---|
| data-active | On each histogram-slider-bar whose centre is inside the range. |