ViewPills: saved views that are addresses
ViewPills draws the saved views of one list, such as All, In progress and Overdue, as links in the pill look, the current one marked. Each view is the same route with another query, so it has its own address, survives a reload and can be shared, and saved views never become sidebar items.
By Bohuslav PoláčekChecked
What it is for, and what the preview shows
ViewPills is the row of saved views above a list: All, Mine, Overdue. Each pill is a link to the same list with another query; the current one is marked for the eye and for screen readers (aria-current="page"), and a pill may carry a count. Because every view is an address, people can bookmark it, share it and come back to it with the browser's back button.
The preview shows the schedule of Stonebridge, a building firm in the demo, with four views (All, In progress, Overdue, At risk from weather) and, beside them, the View menu that sets the chart's scale. Under it are the four addresses: one route, four queries. Then come the starter's purchase requests, whose pills sit in a FilterBar and get their counts once the list has loaded.
The rules, and where each one lives
- Saved views are links, not sidebar items. The root
AGENTS.md(navigation) puts saved views of the same entity into ViewPills and the command palette; another entity gets its own sidebar item. Decision 0009 set it, anddocs/patterns.mdnames Stonebridge and the starter as where it runs. - One route, another query. The runtime audit's
no-entity-switchfails a screen whose pills lead to different routes (docs/audit.md), and ViewPills logs an error in development when its views point at two paths (docs/patterns.md). - Not another presentation. List, board or calendar, day, week or month, is one
DisplayMenubutton, like the View menu beside the pills in the preview; the demo's oldViewSwitchfails the static audit (view-switch). - Not a filter in place. A filter that does not change the address is a
SegmentedControlin a FilterBar (the manifest'snot). - One row. The pills share the one row above the content (
control-rows); when they overflow, they fade at the cut edge and scroll, with chevrons on hover (AGENTS.md).
What AI coding tools write instead
The manifest's replaces lists three habits: sidebar items for saved views, Tabs that only change a query, and hand-built link pills. Asked for "Mine" and "Overdue", an assistant adds two sidebar items or wraps the list in tabs.
Sidebar items for views of one list fill the navigation with near-duplicates and break the rule that the current sidebar item names the page (the audit's nav-matches-crumbs). Tabs keep the view in component state: the address does not change, a reload drops back to All, and a view cannot be sent to a colleague. Hand-built pills drift in size and in how the current one looks from screen to screen. ViewPills keeps every view an address and the look the same on every list.
How to use it
The props, from its exported ViewPillsProps:
views:{ id, label, href, count? }[]. Build everyhrefwith one helper, so the views share a route.current: the id of the view on screen, read from the address.label: the group's accessible name ("Show work").className:min-w-0 flex-1when aDisplayMenusits beside the pills.
The links go through the app shell's renderLink, so they navigate inside the app. Leave count out until the list has loaded, as the starter does, and put the pills into a FilterBar when the list has a search. Both belong to the list pattern.
Its entry in the manifest
| Manifest field | ViewPills |
|---|---|
| What it is | Saved views of one list as links in the pill look, the current one marked. |
| Use it for | Saved views of the same entity on one route (Vše, Moje, Po splatnosti), each its own address. |
| Not for | For a filter applied in place (SegmentedControl in a FilterBar); For another presentation of the same page (DisplayMenu); For different pages (the sidebar) |
| It replaces | Sidebar items for saved views; Tabs that only change a query; Hand-built link pills |
| Screen types | Index; Worklist; Workspace |
| Import | import { ViewPills } from "@meadowstack-studio/kit"; |
Where it runs in the example apps
| Example app | Modules that render it |
|---|---|
| An app for a construction company | Schedule |
How Stonebridge builds its views
const counts = {
all: tasks.length,
running: tasks.filter(matches.running).length,
late: tasks.filter(matches.late).length,
weather: tasks.filter(matches.weather).length,
};
const views = (Object.keys(filterParam) as Filter[]).map((value) => ({
id: value,
label: filterLabel[value],
count: counts[value],
href: filterHref(value),
}));Questions
When are ViewPills better than tabs?
When the views are the same list with another filter. A view that is a link has its own address, so a reload, the back button and a shared link keep it; tabs that only change a query lose it.
Can a view lead to another page?
No. Every pill leads to the same route with another query, and the review audit fails a screen where one does not. Another entity gets its own sidebar item.
Where do a board view and a calendar view go?
Into DisplayMenu, one button beside the pills. Another presentation of the same page is not a saved view, so it does not get a pill.
Should every pill show a count?
Where the count tells something, and only once the list has loaded. Until then the pills show their labels alone, so no number jumps from zero to its value.
What happens when the pills do not fit?
They scroll inside their row and fade at the cut edge, with chevrons on hover, so the row above the list stays one line.
Related
Two ways
Build it yourself, or have it built
Build it yourself
Build your app on the framework
Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.
One payment, lifetime updates
Get the frameworkHave it built
Have us build your app
Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.
After launch, Care keeps it improving, from €99 a month.
from €1,990
Describe your app