Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Filter Sidebar Gallery Block for React

A sidebar of category checkboxes with counts, a two-thumb price slider and a minimum rating select beside twelve drawn lights, with a Sheet for the filters on phones.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A gallery with a filter sidebar for React with Base UI, for Wicklow Lights, a lighting shop. A start-aligned header sits over a split. The sidebar carries the divider, with a + mark where it meets the top rule, and holds category checkboxes with counts, a price range slider with two thumbs and a select for the lowest rating. The grid beside it shows twelve drawn lights on shared hairlines, each with its price and rating. Active filters repeat as removable chips with Clear all, a polite line says "Showing 6 of 12 lights", and a mix that matches nothing shows an empty state. An unseen copy of all twelve holds the block's height. On a phone the sidebar becomes a Sheet behind a "Filters (2)" button and the pictures are two across. It's built from Checkbox, Slider, Select, Sheet, Button, Empty and Guides. The shop, its lights, prices and ratings are made up for the example.

FAQ

How do the three filters combine?

Categories are a union (tick two and you see both kinds), and the price range and the lowest rating then narrow what those kinds show. Each category's count is how many lights it would show under the price and rating now chosen, so it changes as you move the slider. Active filters repeat as chips; removing one moves focus to the status line.

What happens on a phone?

The sidebar is hidden and a "Filters (2)" button, with the number of active filters, opens a Sheet from the bottom with the same three controls, the same state and a "Show 6 lights" button that closes it. Closing it returns focus to the button. The Sheet and the sidebar are two copies of one component, so the ids are scoped.

How is the price slider named and announced?

Its two thumbs read as the lowest and the highest price with their values ("Lowest price: $60"). The visible count updates as you drag, but the polite status line speaks only when you let go, so a screen reader isn't flooded.

Why doesn't the page jump when the pictures change?

An unseen copy of all twelve pictures (hidden from assistive technology and from the keyboard) sits in the same grid cell as the live set, so the block is always as tall as the full gallery and the shown pictures stay at the top. Nothing below the block moves.

Why is the rating a number and a star icon, not the Rating component?

The rating is read-only and part of a caption, so a drawn star next to its number (with "out of 5" for screen readers) is enough, and avoids a read-only Rating's extra tab stop.

How do I use my own photographs?

Each picture is typed data with a description (its alt text), a scene and a ratio. Add your image's address to it, then replace the Scene in its tile with <img alt="" className="size-full object-cover" src={…} />: the caption already names the picture, and the role="img" wrapper's label can move to the alt. The comment above Scene says where. Tiles crop to a fixed shape, so keep object-cover.

  • Pro

    Tagged Gallery

    Filter, sort and tabs

    Twenty-four drawn pictures filtered by a cloud of ten tags with live counts that combine with AND, removable chips, a Clear button and an empty state.

  • Pro

    Filterable Gallery

    Filter, sort and tabs

    Twelve drawn pictures on shared hairlines with a band of chips, each with a count, that keeps only one kind of work and says how many are showing.

  • Pro

    Categorized Tabs Gallery

    Filter, sort and tabs

    A vertical list of five collections, each with its count, beside a grid of that collection's pictures on shared hairlines, with the list carrying the divider.

  • Pro

    Filter Sort Bar Reviews

    Filter and search

    A toolbar band for rain-jacket reviews: a rating Select, a Verified toggle, a date Popover and a sort Select, a live count with removable chips, and the matching reviews as ruled rows.

  • Pro

    Plans as vertical tabs: a rail of tiers with price previews, and a detail panel per plan that opens with its price and call to action, then three highlights and every feature. Three tabs across on a phone.

  • Pro

    Filterable Award List

    Filters and search

    Eighteen awards in two columns narrowed by category chips and a year group, with a live count, a Clear filters button and an empty state.