Skip to content

Components

FilterBar: the one row above a list

FilterBar is the row above every list or board in an app built on Meadowstack: the pills of one filter on the left, the search on the right, and a named button for each further filter after it. When the row runs out of room, the search shrinks first and then the pills take a line of their own, so the row stacks before anything scrolls.

By Bohuslav PoláčekChecked

Kestrel's invoices with nothing filtered, then with Overdue on and the Age filter set, rendered from the kit with the demo's counts. In the app the fill under the chosen pill slides to it; here it is drawn in place.

What it is for, and what the preview shows

FilterBar is the row between a list's header and the list. It holds what narrows the list: the pills of one filter (a status, or the saved views of ViewPills), a search field, and a button for each further filter, named after what it filters. It goes into the screen's toolbar or viewBar, the one row the root AGENTS.md allows above the content.

The preview is the invoice list of Kestrel, an accounting practice in the demo, twice. With nothing filtered, All is on and every status pill carries its count. With Overdue on and the age set, the counts follow the age, and the Age button names its value, so the filter reads without opening it. Each pill and each button sets a parameter in the address, which the card shows.

The rules, and where each one lives

  • Pills left, search right, actions after. The root AGENTS.md (Tables, filter bars) and docs/principles.md (Lightness) give the order; the manifest repeats it as FilterBar's when.
  • A second filter group is a named button. One group of pills a bar; every other filter is a button that names what it filters and, once set, its value ("Age: 1 to 14 days"), as AGENTS.md puts it.
  • One row above the content. Only the header and one row of controls sit above a list, 48px tall at most. The runtime audit's control-rows fails a screen with a second row or a taller one, and allows two lines on a phone (docs/audit.md, decision 0009).
  • Stack before scroll. The bar measures its content: the search shrinks to 160px, then the pills take their own line; pills that still overflow fade at the cut edge and show chevrons on hover (AGENTS.md).
  • No pills in a header. A SegmentedControl inside a Screen's header fails the static audit (segmented-in-header); the pills live in the bar.
  • Kit controls only. An own <input> or <button> in an app fails npm run check:markup (bare-control); FilterBar's search comes labelled.

What AI coding tools write instead

The manifest's replaces names it: a hand-built row of filter buttons and a search input. An assistant writes a flex row with a few toggle buttons and an <input type="search">, and each new filter becomes one more button in the row.

The row holds until the list gets a third filter or meets a phone. Then it wraps into two ragged lines or scrolls sideways, the search keeps its full width while the pills squeeze, and every screen orders its controls differently, so people look for the search in a new place on each list. The filter usually lives in component state, so a reload or a shared link loses it. FilterBar fixes the order and the stacking, and the lists in the demo keep each filter in the address.

How to use it

The props, from FilterBar's signature:

  • search and onSearchChange: the search field's value and its setter.
  • searchLabel: the search field's accessible name and its placeholder ("Search by client, number or reference").
  • children: the pills on the left, a SegmentedControl for a filter applied in place or ViewPills for saved views.
  • actions: what comes after the search: the named filter buttons, each a small Button inside a Picker, and a button that clears a filter set from elsewhere.
  • className.

A Select in actions takes the toolbar's size by itself. Render the list under the bar in DataTable, with isFiltered set while a filter is on, so an empty result offers to clear it. Both belong to the list pattern.

Its entry in the manifest

The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.Read from the kit's component manifest when the site was built (126 components, packages/kit/src/components.json); the same entry answers an AI coding tool through the kit's MCP server.

Where it runs in the example apps

The example apps whose code renders FilterBar, and in which modules, read from the demo's source.Read from the demo's source when the site was built: 9 of 9 example apps render <FilterBar>, in the modules named here as each app's sidebar names them.

How the starter calls it

templates/starter/src/modules/requests/pages/requests-list.tsx
<FilterBar search={search} onSearchChange={setSearch} searchLabel="Search title, supplier, number, person">
  <ViewPills
    label="Views"
    current={status ?? "all"}
    views={[
      { id: "all", label: "All", href: viewHref(null), count: loaded ? all.length : undefined },
      ...statusOrder.map((value) => ({
        id: value,
        label: statusMeta[value].filter,
        href: viewHref(value),
        count: loaded ? all.filter((item) => item.status === value).length : undefined,
      })),
    ]}
  />
</FilterBar>
The starter's purchase requests: the search with its label, and the saved views as the bar's children, their counts shown once the list has loaded.

Questions

What happens when the filters do not fit in one row?

The bar measures its content. The search shrinks to 160px first, then the pills move to a line of their own; pills that still do not fit fade at the cut edge and scroll, with chevrons on hover.

Should a second filter be another row of pills?

No. A bar has one group of pills. Every other filter is a button named after what it filters, and once it is set the button shows its value, like Age: 1 to 14 days.

Where does the filter state live?

In the address, in the demo's lists: each pill and each filter button sets a query parameter, so a reload, the back button and a shared link keep the same view.

Is FilterBar the place for list, board and calendar?

No. Another presentation of the same page is one DisplayMenu button in the same row, and saved views of the same list are ViewPills inside the bar.

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 framework
  • Have 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