shadcn.io is not affiliated with official shadcn/ui
Tags Table Block for React
A note library whose rows carry tag buttons: two show and a plus button opens the rest in a popover, pressing any tag filters the table to the notes that have it, and a strip says Tag and how many of the seven remain.
Installation
Overview
Let the tags do the filtering, with this tags table for React with Base UI. A framed panel holds a native table of seven notes from a note library (title, tags, words and the day edited), and each note's tags are buttons you press. Two tags show (one on a phone) and the rest wait behind a "+3" button that opens a Popover listing them. Pressing any tag, in the table or the popover, filters the table to the notes that carry it: a strip above it says "Tag: design" and "Showing 3 of 7 notes tagged design", and pressing the tag again, or Clear, brings every note back. The pressed tag moves to the front of each row, so a note that matches through a tag behind the plus still shows why. The table sits in a fixed-height region and its body is keyed by the filter, so choosing a tag never moves the panel, and focus stays on the tag you pressed. Tags are Badges made pressable, filled solid when pressed. It's built from Badge, Popover, Button and Guides, with a CSS entrance only. For note libraries, content tables, issue lists and any rows with several labels.
FAQ
What does pressing a tag do?
It filters the table to the notes that have that tag and marks the tag pressed (aria-pressed) everywhere it appears. One tag is active at a time: pressing another switches to it, pressing the active one clears it. The strip names the tag and the count, and the same sentence is the block's one polite line.
How are the extra tags handled?
A row shows two tags, or one on a phone, and a button named like "3 more tags on Pricing page rewrite" opens a popover with the rest as the same pressable tags. Pressing one filters and closes the popover, because the table body is rebuilt. The pressed tag moves to the front of its row, so focus lands on it there; pressing the active tag again puts it back in its place, and focus goes to that row's plus button when it now sits behind it.
Why doesn't the page jump when I filter?
The table lives in a fixed-height region with a sticky head, the rows keep one fixed height, and the body is keyed by the active tag, so rows leave and return without moving anything around them. Every tag in the vocabulary is on at least two notes, so a filter can't empty the table.
Is it accessible?
Every tag is a native button with a name that says which note it is on ("design, tag on Pricing page rewrite") and aria-pressed for its state. The popover closes with Escape and returns focus to its button. Pressed tags are a solid foreground fill, never a colour, and the counts and the filter are in words.
Related
- 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
Color Indicator Table
Rich cellsA project table whose categories are marked by shape, weight and word, never colour: a circle, square, diamond and triangle in foreground weights, and a legend of toggle chips with counts that dims the other categories.
- Pro
Searchable Catalogue Table
Sort and searchA library catalogue table with a search field and an availability menu: typing keeps the titles whose name or author holds the words and marks them, the foot says how many match, and an empty state under the head clears the search.
- Pro
Avatar Stack Table
Rich cellsA sprint board whose assignee cell is a stack of initials and a plus count that opens a popover of checkboxes: ticking assigns a teammate, unticking removes them, an empty cell is a dashed circle and Unassigned.
- Pro
Badge Count Table
Rich cellsModeration queues as counts: compact badges like 1.2K, a quiet dash for zero, a strip of three totals and a number field that flags any queue past a limit with a flag glyph and the words Over limit, never a colour.
- Pro
Link Cell Table
Rich cellsA reading list whose titles are real links: an arrow and a name that says opens in a new tab on links to other sites, plain links inside the app, truncated hosts with the whole address in a title, and a preview card on hover or focus.