shadcn.io is not affiliated with official shadcn/ui
Filter Overlap Empty Results Error Block for React
A results panel for filters that match nothing: three toggle chips over 24 kits, a table of how many kits each pair of filters shares, the empty pair ringed, and a chip off to bring results back.
Installation
Overview
Tell people why a filtered list is empty, not only that it is, with this filter overlap panel for React with Base UI. It's the catalog of Kitstall, a marketplace for interface kits: a header over one framed panel, its bands ruled by Guides. A band holds three filters as toggle chips (Price: Free, License: Commercial, Updated: Last 7 days), each a native button styled like an outline Button and solid in the foreground color while the filter is on. The results band lists the first three kits that pass every filter that is on; when none does, it tests each pair of filters against the 24 typed kits and lists how many they share, marks the pair with nothing in common and rings its two chips. Turning one of those chips off brings kits back and the count follows; turning it on again takes them away. The one Shine Button, Reset all filters, turns every chip off, and Restore turns them back on. It's built from Button, Shine Button, Empty and Guides, with a CSS entrance only. For marketplaces, catalogs and any list with more than one filter.
FAQ
How are the pairs worked out?
A small pure helper takes the filters that are on, makes every pair of them and counts the typed kits that pass both. The empty pair is the one with a count of 0. Here the free kits are all for personal use, so Free and Commercial share nothing, while Free and Last 7 days share 5 and Commercial and Last 7 days share 3. Edit KITS and the counts, the table, the ringed chips and the headline all follow.
Are the chips real controls?
Yes. Each is a native button with aria-pressed: solid with a cross while the filter is on, outlined, struck through and with a plus when it is off. Pressing one never changes the chips' places, since a turned-off chip keeps its slot, so it can be turned back on.
What stays in the page, and how do I wire it?
The catalog is typed in the file and every control changes only this page's state; the polite status line ("2 filters on, 3 kits match.") is worked out from the chips, so it is always true. In your product, run the filters on your server, and count the pairs there if the catalog is large, then send the counts with the empty result.
Does the panel change height?
No. The results band keeps an unseen copy of the full empty table (all three pairs) in the same cell as the live content, so the list of three kits, a shorter table and the full table all fit the same box.
What do Reset all filters and Restore do?
Reset turns every chip off, so all 24 kits show, newest first, three at a time. When nothing is on, the button stays visible, quiet, and says so if pressed. Restore turns the three chips back on and brings the empty state with them, so the demo can be run again.
Related
- Pro
Scope Counts Empty Search Error
Empty statesA docs search page for a query that finds nothing in the current scope: a large query field over five scopes with live counts, results for the scope you choose, and one button to search everything.
- Pro
Chip Filters Table
Sort and searchA bug table beside a rail of chip filters for priority and status: chips in a group are or, the groups are and, every chip counts what it would show, and an empty state clears them all.
- Pro
Filter Sort Dialog
Side sheetsA vinyl shop's records page with its filter panel shown open as a sheet from the start edge: genre chips, a decade list, a two-thumb price range, conditions, an in-stock switch and a sort order, all changing the grid behind it as you touch them.
- Pro
Empty States Table
Sort and searchA contact book table with two empty states you reach by doing something: searching for text that is not there, and removing every contact after a confirm, then adding the samples back, all at one fixed height.
- Pro
Search Command 404 Error
Not foundA full-height 404 page for a knitting-pattern library: the display 404, a heading that names the missing address, an inline command list in a framed panel that shows five popular pages and filters ten as you type, and one button to the homepage.
- Pro
Expired Holds Empty Cart Error
Empty statesA cart page that is empty because its 30-minute hold ran out: the two released items, one still in stock and one sold out, with Add back, Tell me when it is back, a subtotal and a bar to free delivery.