StealThis .dev

Shop — Faceted Filter Sidebar

A reusable product-listing filter rail with collapsible facet groups: category checkboxes with live counts, a true dual-handle price range slider, a color swatch grid, size chips that disable when empty, a star-rating filter, a searchable brand list with match highlighting, and an in-stock toggle. Every control updates a live result count and a removable active-filters chip row, with clear-all reset and a slide-in mobile drawer. Built with vanilla JS and no libraries.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Faceted Filter Sidebar

The reusable filter rail every product-listing page needs. Collapsible facet groups stack down a sticky sidebar: category checkboxes that show how many products each option would add, a real dual-handle price slider with a clamped minimum gap, a tappable color swatch grid, US size chips that disable themselves when nothing’s in stock, a star-rating radio group, a searchable brand list that highlights matches as you type, and a green in-stock toggle. A live result count and a paired product grid (inline-SVG “shoe photography” on soft tinted tiles) react instantly to confirm every facet works.

Each control updates an active-filters chip row at the top of the rail — every chip carries its own × to remove just that filter, color chips even mirror the swatch. The applied count surfaces in three places (a badge by the title, the chip total, and the mobile Filters button), and Clear all resets the entire state in one tap. Counts recompute against the other active facets, so the numbers always reflect what you’d actually get. Sorting (Featured, price low/high, top rated) reorders the preview grid without touching the filters.

On narrow screens the rail collapses into a slide-in drawer behind a Filters button, closable by the overlay, the close icon, or Escape, with a sticky “Show N results” apply bar at the bottom. Facet headers collapse and expand, the grid steps from three columns to one, and everything stays keyboard-operable with visible focus rings, ARIA roles on the custom swatch, chip, rating, and toggle controls, and an empty state when no products match.

Illustrative storefront UI only — fictional products, prices, and reviews. No real checkout.