Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Tagged Gallery Block for React

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.

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 faceted gallery for React with Base UI, for Objectry, a shop for homewares. A start-aligned header sits over a cloud of ten tags in a multi-select ToggleGroup, each with a count. Tags combine with AND: a picture stays only if it has every tag chosen, and each count says how many pictures would remain if you also chose that tag (a tag that would leave none is drawn dashed). The choice repeats as removable chips with a Clear button, a polite line says "Showing 4 of 24 objects", and a mix that matches nothing shows an empty state. Twenty-four drawn pictures sit on shared hairlines; the rest re-lay from the start and blank cells finish the last row. On a phone the cloud scrolls sideways and the pictures are three across without captions. The pictures are drawn, not photographed, in your theme's own greys. It's built from ToggleGroup, Button, Empty and Guides. The shop and its things are made up for the example.

FAQ

How do the counts work?

Each tag's count is the number of pictures that match every tag already chosen plus that one, so with nothing chosen it is the tag's total, and choosing "Kitchen" turns "Glass" into the number of glass things for the kitchen. A chosen tag shows what is left now. A tag that would leave nothing is dashed and still works: choosing it shows the empty state with a button that clears the tags.

What are the chips under the cloud for?

They repeat the choice in order, each a button that removes its tag, and a Clear button removes them all. When a chip is removed, focus returns to its tag in the cloud; Clear returns it to the first tag. With nothing chosen the row says so, and it keeps its height.

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

An unseen copy of all twenty-four 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.

How does it fit on a phone?

The cloud is a single row that scrolls sideways (the group is a tab stop with a visible ring) and the chips scroll in their own row. The pictures are three across and their captions are kept for screen readers only, to fit the first screen.

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.

How are the pictures drawn?

Each one is a scene: a kind (a room, a lamp, a bridge, a pattern…) and three numbers, light, horizon and a seed that moves ridgelines, lights windows and turns tiles. Each kind is a function that returns the picture as SVG paths painted with a few inks mixed from your theme's colours, so two pictures of one kind with different numbers differ. Nothing is random at render time: the server and the browser draw the same picture.

  • 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

    Tone Filter Gallery

    Filter, sort and tabs

    Five greyscale swatches (Paper to Ink) with counts, a Sort by contrast button and twelve framed pictures whose tone and contrast are read from their own drawings.

  • Pro

    Filter Sidebar Gallery

    Filter, sort and tabs

    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.

  • Pro

    A coffee journal's archive with a ruled band of category chips and their counts over eight post cells: choosing a chip removes the other posts, a polite line says how many show, and the wall keeps its height.

  • 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

    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.