# 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.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/components/filter-bar/

*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.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/components/filter-bar/

## 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](https://meadowstack.com/components/view-pills/)), 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](https://meadowstack.com/examples/accounting-office-documents/), 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](https://meadowstack.com/components/data-table/), with `isFiltered` set while a filter is on, so an empty result offers to clear it. Both belong to the [list pattern](https://meadowstack.com/patterns/list/).

## Its entry in the manifest

*The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.*

| Manifest field | FilterBar |
| --- | --- |
| What it is | Search, filters and view controls above a table or board. |
| Use it for | Above every list or board: pills left, search right, actions after. |
| Not for | For a record's tabs (Tabs) |
| It replaces | A hand-built row of filter buttons and a search input |
| Screen types | Index; Worklist; Workspace |
| Import | `import { FilterBar } from "@meadowstack-studio/kit";` |

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.*

| Example app | Modules that render it |
| --- | --- |
| [An app for a packaging and print company](https://meadowstack.com/examples/packaging-print-production/) | Jobs, Print file editor, Quotes, Cutting dies, Colour |
| [An app for a studio or agency](https://meadowstack.com/examples/agency-capacity-planning/) | Capacity, Tasks, Finance |
| [An app for a haulage company](https://meadowstack.com/examples/haulage-dispatch-planning/) | Freight, Drivers, Costs |
| [An app for a roastery with an online shop](https://meadowstack.com/examples/coffee-roastery-production/) | Roasting, Shop, Wholesale |
| [An app for a sports club](https://meadowstack.com/examples/sports-club-court-bookings/) | Club, Coaching, Rentals |
| [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) | Sites, Crews, Machines, Site diary, Drawings, Budget |
| [An app for an accounting office](https://meadowstack.com/examples/accounting-office-documents/) | Documents, Bookkeeping, Official mail, Invoicing |
| [An app for restaurants and venues](https://meadowstack.com/examples/restaurant-staff-rota/) | Kitchen, People |
| [An app for one person](https://meadowstack.com/examples/personal-app-for-a-creator/) | Brand deals, Content, Money, Training |

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

*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.*

From `templates/starter/src/modules/requests/pages/requests-list.tsx` in the Meadowstack repository:

```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>
```

## 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.

## Related

- [DataTable: the table of every list](https://meadowstack.com/components/data-table/) (Components)
- [ViewPills: saved views that are addresses](https://meadowstack.com/components/view-pills/) (Components)
- [A weekly timesheet for an agency](https://meadowstack.com/screens/timesheet/) (Screens)
- [AsyncState: every data view has four states](https://meadowstack.com/components/async-state/) (Components)
- [BulkBar: what to do with the selection](https://meadowstack.com/components/bulk-bar/) (Components)
- [Loading, error, empty and no results](https://meadowstack.com/patterns/data-states/) (Patterns)
