# Ecommerce Category Filter: Horizontal Filters

A row of filter dropdowns and chips sitting above the product grid. Lets shoppers narrow by category, price, and brand without giving up vertical space.

- Page: https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-filters/horizontal-filters
- Collection: [Ecommerce](https://www.shadcn-ui-blocks.com/blocks/ecommerce), Free tier
- Group: [Category Filters](https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-filters)
- Created: 2026-06-14
- Preview image: https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-filters/horizontal-filters.png

## Install

```bash
npx shadcn@latest add @shadcn-ui-blocks/ecommerce-category-filters-horizontal-filters
```

A free block: it installs with no account or key. Or install it by URL: `npx shadcn@latest add "https://www.shadcn-ui-blocks.com/r/ecommerce-category-filters-horizontal-filters.json"`.

## Depends on

- npm packages: @radix-ui/react-slider, class-variance-authority, lucide-react, radix-ui
- shadcn/ui components: badge, button, dropdown-menu, popover, scroll-area, separator
- Installs to: `@/components/blocks/ecommerce/category-filters/horizontal-filters`

## About this block

Horizontal Filters is a compact toolbar that sits above a product grid. A
row of outline buttons, one each for Category, Brand, Price, Size, and
Color, opens a popover when clicked. The Category and Brand popovers show
a plain list where each option toggles on with a checkmark. The Price
popover holds a two-handle range slider with live dollar readouts. The
Size popover shows a three-column grid of toggle buttons. The Color
popover shows circular swatches with a ring highlight and a checkmark
when selected. A Sort dropdown anchored to the right of the toolbar lets
visitors order results by featured, price, or recency. On narrow screens
the individual filter buttons are replaced by a single "All Filters"
button with an active-count badge; tapping it opens a full-height slide-in
panel that mirrors every filter in a scrollable list.

When at least one filter is active, a row of outline badges appears below
the toolbar. Each badge names the active value and carries an X button to
remove it inline. A "Clear all" button at the end of the row resets
everything at once. All filter state is tracked internally, and an
optional callback fires on every change so you can wire results to a
sibling grid without managing state outside the block.

## When to use

This layout suits any listing page where screen space is at a premium and
shoppers need to narrow a large set of results without losing sight of the
grid. It works especially well for a real estate marketplace where buyers
want to filter by property type, price band, and other attributes while
keeping as many listings visible as possible. The horizontal bar adds less
visual weight than a sidebar, so the listings always feel like the main
event. When the filter count is small and the audience skews mobile, the
[Filter Drawer](https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-filters/filter-drawer) is a
closer fit; when you need facets and counts alongside each option, the
[Filter Demo](https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-filters/filter-demo) sidebar
gives you more room.

A natural flow around it on an Ecommerce page:

**Before**

- A [Category Preview](https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-preview) section to let
  visitors browse by top-level segment before landing on the listing
- A short hero or section heading to set the context for the current
  collection

**After**

- A [Product List](https://www.shadcn-ui-blocks.com/blocks/ecommerce/product-list) to display the
  filtered results directly beneath the toolbar
- A [Promo Sections](https://www.shadcn-ui-blocks.com/blocks/ecommerce/promo-sections) block to surface
  a featured offer after the first page of results

## What you can customize

Each popover is self-contained, so you can add, remove, or rename any
filter group without touching the others.

- **Filter dimensions.** Swap the demo categories, brands, sizes, and
  colors for your own values by editing the corresponding arrays; the
  popover layout adjusts automatically.
- **Price range bounds.** The slider runs from 0 to 500 by default; set
  the min, max, and step to match your catalog's actual price spread.
- **Sort options.** The dropdown reads from a plain array, so you can
  add, remove, or relabel sort modes to match your backend's sort keys.

> Tip: wire the `onFilterChange` callback to your data-fetching layer so
> the grid re-queries on every selection rather than waiting for an apply
> button.

## More in Ecommerce Category Filters

- [Filter Demo](https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-filters/filter-demo)
- [Filter Drawer](https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-filters/filter-drawer)
