Range Slider Histogram

A price filter built on top of the distribution it filters, so the handles land where the results actually are.

Price167 results
$126$408

Build a price range filter that sits on top of a histogram of the results. Structure, top to bottom: a header row with a label and a live result count; a row of histogram bars (14 of them, heights from a distribution array); a slider track with a filled range and two round handles; and a row showing the current low and high values. The histogram is the point. Each bar's height is its share of the maximum. Bars whose center falls inside the range are full-opacity accent; bars outside drop to about 0.22 opacity and switch to plain ink, over 0.22s. Do not hide the excluded bars - a filter you cannot see the outside of is a filter you cannot reason about. The handles must work with a finger. Use pointer events, not mouse events: onPointerDown on each handle records which handle is active, and a pointermove listener on the WINDOW (not the track) computes the fraction from the track's getBoundingClientRect. Putting the listener on the window is what lets a drag continue when the pointer leaves the track, which happens the first time anyone actually pulls a handle. Set touchAction: "none" on the handles so the browser does not steal the gesture for scrolling. Clamp each handle against the other with a small minimum gap (about 4%) so the range can never invert. Handles and the filled range animate with a spring (stiffness ~320, damping ~30) when set programmatically, and follow the pointer directly while dragging. Handles scale to about 1.18 on tap. Accessibility: give each handle an aria-label ("Minimum price" / "Maximum price") and make the result count aria-live="polite". The bars are decorative. Under prefers-reduced-motion, drop the springs and the bar transitions; dragging still works. Colors as tokens: paper surface, ink for excluded bars, one accent for the range, bars in range, and the handle borders. Build the component, not this demo of it. - Ambient motion that IS the component may loop: a drifting background, a marquee, a spinner while something is genuinely loading. - Do not add any timer, interval, loop or script that performs a person's action by itself. No auto-hover, no auto-click, no cycling through states, no pretend submitting, no replaying the interaction on a schedule. - Every state that answers a person waits for a real event from that person. - Placeholder copy and sample content are welcome. Simulated behaviour is not.

Rate it
0
0

We'd like to measure how the site gets used, with Google Analytics. It sets cookies. Everything the site needs to work runs either way. How we handle data