<!-- generated by scripts/gen-docs.mjs from docs/system/filter-bar.md. Edit the source and rerun. -->
# FilterBar

## Description
Narrows a list by several fields at once, each a pill that opens its options and names what it holds, so a person sees which filters are on without opening any.

`import { FilterBar, FilterPill, FilterList, filterSummary, filterCount, filterLabels, slashFocusesSearch, type Filter, type ListFilter, type RangeFilterItem, type FilterSearch, type FilterOption } from "@/components/cobalt/ui/filter-bar"`, source `registry/cobalt/ui/filter-bar.tsx`, status `ready-with-gaps`.
Foundation: `team composition over Popover, Sheet, Input and the menu row`. Traps checked: `trap/menu-navigation`, `trap/open-trigger-unfocused`, `trap/overlay-focus-return`, `trap/escape-nested`, `trap/loading-layout-shift`, `trap/select-async`, `trap/numbers-shift`, `trap/control-height`, `trap/narrow-hidden-nav`, `trap/color-only-status`, `trap/live-region-double`.

Where each trap is answered: `trap/menu-navigation` and `trap/escape-nested` in Keyboard, the arrows walk the rows and Escape closes the list only; `trap/open-trigger-unfocused` and `trap/overlay-focus-return` in Keyboard, focus enters the list on open and returns to the pill; `trap/loading-layout-shift` in States, Clear holds its place in the row and in the list, measured as a 32px bar before and after a choice; `trap/select-async` in States, options that load show skeleton rows and a failure offers Retry; `trap/numbers-shift` in Content, counts are tabular and compact; `trap/control-height` in Tokens, the pill is `--control-sm`; `trap/narrow-hidden-nav` in Limits and States, below 640px the row folds into one pill whose sheet holds every filter; `trap/color-only-status` in States, an option that is on carries a check and `aria-checked`; `trap/live-region-double`, nothing here is a live region, the list it filters announces its own count.

### Foundation
| Given by the foundation | Added by the team |
|---|---|
| Base UI `Popover` through this registry: the trigger with `aria-haspopup="dialog"` and `aria-expanded`, the portal, placement below the start edge with 4px, Escape and an outside press to close, focus back to the trigger; `Sheet` for the phone and More filters; `Input` for the search; the menu row recipe (`menuItemClasses`) | The pill on `pillClasses` at `--control-sm`, reading the label, the one choice, or the first choice and "+N", with every choice in its accessible name; `FilterList`, one list of options as buttons with the checkbox role (radio for `single`), each with an optional facet count in compact tabular figures and a check at its end, shared with a DataTable column's `filter`; a search field once there are more than 8 options, 6px in from the popup's edge as the rows are, so its 10px corner is concentric with the 16px popup; a Clear row that is always there and inert until something is chosen; options that load: skeleton rows, dimmed rows after 250ms, a failure line with Retry; the arrow keys and the pointer highlight from `registry/cobalt/lib/rove.ts`; `FilterBar`, the row of pills with More filters for the filters marked `more`, a ghost Clear that holds its place while hidden, and below 640px one Filters pill with the count of choices that opens a sheet with every filter |

## Examples
Filters over a fund list: Type is on and reads "Hedge fund"; each option counts the funds it would show with the other filters as they are.

Real uses, 0 call sites (`rg -n "<FilterBar\b" app registry --glob '!registry/cobalt/ui/*'`): the screener scene uses it, and the examples folder does not count.

Planned uses:
- The screener's filters, Type, Gross assets as one choice, Domicile, Structure and Auditor behind More filters, with facet counts, `docs/system/examples/blocks/screener.tsx:865-879`.
- A DataTable column's filter, the bookings' Room, `docs/system/examples/data-table/filtered.tsx:63`.

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/filter-bar/default.tsx` | default | Each pill names what it holds. Clear keeps its place at the end of the row while hidden, so it comes and goes without moving the pills |
| `docs/system/examples/filter-bar/searchable.tsx` | state:searching | Past 8 options the list opens with a search field, and the pill reads the first choice and how many more |
| `docs/system/examples/filter-bar/one-choice.tsx` | state:single | A size floor picks one option and closes; the pill reads the choice, and Clear in the list puts it back to any size |
| `docs/system/examples/filter-bar/pending.tsx` | state:pending | The adviser options load the first time the pill opens, so the list holds skeleton rows and says it is loading until they come; a failure offers Retry |
| Not applicable: default.tsx opens with Type on | state:chosen | The pill in the ink fill, reading the choice |
| Not applicable: every example takes the phone layout below 640px | state:phone | One Filters pill with the count, opening a sheet with every filter |
| `docs/system/examples/filter-bar/with-search.tsx` | composition:RangeFilter | A search above the pills, which "/" reaches from anywhere on the page but a field; the key shows in the field until it is used. Assets is a range among the pills |
| `docs/system/examples/filter-bar/in-data-table.tsx` | composition:DataTable | The table opens narrowed to one room from the Room column's header, whose menu holds the same options as a filter pill |

Example: Each pill names what it holds. Clear keeps its place at the end of the row while hidden, so it comes and goes without moving the pills (`docs/system/examples/filter-bar/default.tsx`)

```tsx
import { useState } from "react";

import { type Filter, FilterBar } from "@/components/cobalt/ui/filter-bar";

// Inert sample data: invented funds, the same kinds the screener scene shows.
const funds = [
  { type: "Hedge fund", domicile: "Cayman Islands", auditor: "Ashby Wren LLP" },
  { type: "Hedge fund", domicile: "Cayman Islands", auditor: "Marlow Kent LLP" },
  { type: "Private equity", domicile: "Delaware", auditor: "Pryor Dean LLP" },
  { type: "Private credit", domicile: "Luxembourg", auditor: "Hollis Crane LLP" },
  { type: "Hedge fund", domicile: "Ireland", auditor: "Ashby Wren LLP" },
  { type: "Real estate", domicile: "Delaware", auditor: "Marlow Kent LLP" },
  { type: "Private credit", domicile: "Delaware", auditor: "Pryor Dean LLP" },
];
type Key = "type" | "domicile" | "auditor";

export default function Example() {
  const [chosen, setChosen] = useState<Record<Key, string[]>>({ type: ["Hedge fund"], domicile: [], auditor: [] });
  const passes = (f: (typeof funds)[number], skip?: Key) =>
    (Object.keys(chosen) as Key[]).every((k) => k === skip || chosen[k].length === 0 || chosen[k].includes(f[k]));
  // Each option counts the funds it would show with the other filters as they are.
  const facet = (key: Key, label: string, more = false): Filter => ({
    key,
    label,
    more,
    options: [...new Set(funds.map((f) => f[key]))].map((value) => ({
      value,
      label: value,
      count: funds.filter((f) => passes(f, key) && f[key] === value).length,
    })),
    value: chosen[key],
    onValueChange: (next) => setChosen((was) => ({ ...was, [key]: next })),
  });
  const shown = funds.filter((f) => passes(f)).length;
  return (
    <div className="flex w-full flex-col gap-3">
      <FilterBar
        filters={[facet("type", "Type"), facet("domicile", "Domicile"), facet("auditor", "Auditor", true)]}
        done={`Show ${shown} funds`}
      />
      <p className="text-sm text-muted-foreground">
        <span className="font-medium text-foreground tabular-nums">{shown}</span> funds
      </p>
    </div>
  );
}
```

Example: A search above the pills, which "/" reaches from anywhere on the page but a field; the key shows in the field until it is used. Assets is a range among the pills (`docs/system/examples/filter-bar/with-search.tsx`)

```tsx
import { useState } from "react";

import { type Filter, FilterBar } from "@/components/cobalt/ui/filter-bar";
import type { Bound } from "@/lib/cobalt/range";

// Inert sample data: invented funds, the same kinds the screener scene shows.
const funds = [
  { name: "Harbour Large Cap Core", type: "Hedge fund", assets: 4.2e9 },
  { name: "Calder Global Equity", type: "Hedge fund", assets: 860e6 },
  { name: "Northgate Short Duration", type: "Private credit", assets: 12.5e9 },
  { name: "Pryor Dean Real Assets", type: "Real estate", assets: 310e6 },
  { name: "Ashby Wren Growth", type: "Private equity", assets: 2.1e9 },
  { name: "Hollis Crane Income", type: "Private credit", assets: 48e6 },
  { name: "Marlow Kent Opportunities", type: "Hedge fund", assets: 1.4e9 },
];

export default function Example() {
  const [query, setQuery] = useState("");
  const [types, setTypes] = useState<string[]>([]);
  const [assets, setAssets] = useState<[Bound, Bound]>([null, null]);
  const needle = query.trim().toLowerCase();
  const shown = funds.filter(
    (f) =>
      f.name.toLowerCase().includes(needle) &&
      (types.length === 0 || types.includes(f.type)) &&
      (assets[0] === null || f.assets >= assets[0]) &&
      (assets[1] === null || f.assets <= assets[1]),
  );
  const filters: Filter[] = [
    {
      key: "type",
      label: "Type",
      options: [...new Set(funds.map((f) => f.type))].map((value) => ({
        value,
        label: value,
        count: funds.filter((f) => f.type === value).length,
      })),
      value: types,
      onValueChange: setTypes,
    },
    {
      key: "assets",
      type: "range",
      label: "Assets",
      value: assets,
      onValueChange: setAssets,
      min: 1e6,
      max: 1e12,
      scale: "log",
      kind: "money",
      presets: [
        { label: "$1B or more", value: [1e9, null] },
        { label: "$10B or more", value: [1e10, null] },
      ],
    },
  ];
  return (
    <div className="flex w-full max-w-xl flex-col gap-3">
      <FilterBar
        search={{ value: query, onValueChange: setQuery, label: "Search funds", shortcut: true }}
        filters={filters}
        done={`Show ${shown.length} funds`}
      />
      <ul className="flex flex-col text-sm">
        {shown.map((fund) => (
          <li key={fund.name} className="flex min-h-10 items-center justify-between gap-3">
            <span className="min-w-0 truncate">{fund.name}</span>
            <span className="shrink-0 text-muted-foreground">{fund.type}</span>
          </li>
        ))}
        {shown.length === 0 && <li className="flex min-h-10 items-center text-muted-foreground">No fund matches.</li>}
      </ul>
    </div>
  );
}
```

Example: The table opens narrowed to one room from the Room column's header, whose menu holds the same options as a filter pill (`docs/system/examples/filter-bar/in-data-table.tsx`)

```tsx
import { useMemo, useState } from "react";

import { type Column, DataTable } from "@/components/cobalt/ui/data-table";
import { FilterList } from "@/components/cobalt/ui/filter-bar";
import { counted, money } from "@/lib/cobalt/format";

type Booking = { ref: string; guest: string; room: string; total: number };
const rooms = ["Garden double", "Harbour suite", "Courtyard twin", "Loft studio"];
const guests = ["Amara Okafor", "Lukas Brandt", "Priya Raman", "Tomás Ibarra", "Hanna Lindqvist"];
// Computed from the index, so the table reads the same on every visit.
const bookings: Booking[] = Array.from({ length: 16 }, (_, i) => ({
  ref: `BK-${48_201 + i}`,
  guest: guests[(i * 3) % guests.length] ?? "",
  room: rooms[(i * 7) % rooms.length] ?? "",
  total: 150 + ((i * 97) % 600),
}));

export default function Example() {
  const [room, setRoom] = useState<string[]>(["Harbour suite"]);
  const columns = useMemo<Column<Booking>[]>(
    () => [
      { key: "ref", label: "Booking", kind: "code", width: 110 },
      { key: "guest", label: "Guest", kind: "text" },
      {
        key: "room",
        label: "Room",
        kind: "text",
        filtered: room.length > 0,
        filter: ({ close }) => (
          <FilterList
            label="Room"
            options={rooms.map((r) => ({ value: r, label: r, count: bookings.filter((b) => b.room === r).length }))}
            value={room}
            onValueChange={setRoom}
            close={close}
          />
        ),
      },
      { key: "total", label: "Total", kind: "number", cell: (row) => money(row.total) },
    ],
    [room],
  );
  const rows = room.length === 0 ? bookings : bookings.filter((b) => room.includes(b.room));
  return (
    <div className="overflow-hidden rounded-2xl bg-card">
      <DataTable
        label="Bookings"
        columns={columns}
        rows={rows}
        getRowId={(row) => row.ref}
        maxRows={6}
        phoneMain="guest"
        labels={{ rowCount: (count) => counted(count, { one: "booking", other: "bookings" }) }}
      />
    </div>
  );
}
```

## Variants
Not applicable: FilterBar has no variant axis. A filter is one choice or several through `single`, and searchable past 8 options through `search`, both shown in States.

## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| idle | nothing chosen | open a pill, pick | the pill reads its label on the grey fill; Clear is hidden and holds its place | test |
| chosen | a filter's `value` holds a choice | open it, change or clear it, press Clear | the pill in the ink fill reads "Hedge fund" or "Hedge fund +1", and its accessible name lists every choice; the row's check and `aria-checked="true"` | test |
| open | a press, Enter or Space on a pill | search, move with the arrows, pick with Space or Enter, Escape | the list 4px below the pill's start edge, `aria-expanded="true"`, focus on the search; with no search, on the first row after the keyboard opened it and on the list itself after a pointer did, so no row is lit until the arrows or the pointer reach one (`openFocus` in `registry/cobalt/lib/rove.ts`) | by hand |
| searching | more than 8 options, or `search` | type to narrow the rows | the search field at the top; "No matches" when nothing matches | test |
| single | `single` | pick one option, which closes the list | the options are radios; the pill reads the choice | test |
| pending | `status="pending"` | wait, or read the rows already there | three skeleton rows with "Loading options" for a screen reader and `aria-busy`; rows already there dim to 55 percent after 250ms | test |
| failure | `status="failure"` with no options | press Retry | "Could not load the options" and Retry, as an alert | test |
| phone | viewport below 640px | open the one Filters pill, choose in its sheet, Done | "Filters" and the count of choices, a set range counting one, "Filters, 3 on" for a screen reader; the sheet lists every filter, a range as its fields, track and presets under its name; Clear beside the pill on the same line; measured "Filters, 1 on" with Clear at the same y for the slider example, where the range was left out of the sheet and the count and Clear sat alone on a second line before (`.design-system/evidence/filter-bar/range-search-2026-10-17.json`) | screenshot |
| range | a filter with `type: "range"` | open its pill, drag, type a bound, pick a preset, Clear | the pill reads the name, then the name and the range in the ink fill ("Assets $1B or more"); in the sheet the same fields and presets, the list hearing the finished range only | test |
| search | `search` | type to narrow the list; with `shortcut`, press / from anywhere but a field, a menu or a dialog | the field above the pills; with `shortcut`, a "/" key cap at its end on a pointer that hovers, fading out on focus or text, and none under a coarse pointer | test |

Example: Past 8 options the list opens with a search field, and the pill reads the first choice and how many more (`docs/system/examples/filter-bar/searchable.tsx`)

```tsx
import { useState } from "react";

import { FilterPill } from "@/components/cobalt/ui/filter-bar";

const domiciles = [
  "Bermuda", "British Virgin Islands", "Canada", "Cayman Islands", "Channel Islands", "Cyprus", "Delaware", "France",
  "Germany", "Gibraltar", "Guernsey", "Hong Kong", "Ireland", "Isle of Man", "Japan", "Jersey", "Liechtenstein",
  "Luxembourg", "Malta", "Mauritius", "Netherlands", "Singapore", "Switzerland", "United Kingdom",
];

export default function Example() {
  const [value, setValue] = useState(["Ireland", "Luxembourg"]);
  return (
    <FilterPill
      label="Domicile"
      options={domiciles.map((d, i) => ({ value: d, label: d, count: ((i * 37) % 180) + 2 }))}
      value={value}
      onValueChange={setValue}
    />
  );
}
```

Example: A size floor picks one option and closes; the pill reads the choice, and Clear in the list puts it back to any size (`docs/system/examples/filter-bar/one-choice.tsx`)

```tsx
import { useState } from "react";

import { FilterPill } from "@/components/cobalt/ui/filter-bar";

export default function Example() {
  const [floor, setFloor] = useState<string[]>([]);
  return (
    <FilterPill
      label="Gross assets"
      single
      options={[
        { value: "1B", label: "Over $1B" },
        { value: "10B", label: "Over $10B" },
        { value: "50B", label: "Over $50B" },
      ]}
      value={floor}
      onValueChange={setFloor}
    />
  );
}
```

Example: The adviser options load the first time the pill opens, so the list holds skeleton rows and says it is loading until they come; a failure offers Retry (`docs/system/examples/filter-bar/pending.tsx`)

```tsx
import { useState } from "react";

import { type FilterOption, FilterPill } from "@/components/cobalt/ui/filter-bar";
import type { Status } from "@/lib/cobalt/status";

// Stands in for your API call. It answers after 2 seconds, and fails while the browser is offline or
// the address has ?network=offline.
const offline = () => !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
const advisers: FilterOption[] = [
  { value: "harbour", label: "Harbour Street Partners", count: 12 },
  { value: "calder", label: "Calder Investment Management", count: 9 },
  { value: "northgate", label: "Northgate Advisors", count: 4 },
];

export default function Example() {
  const [status, setStatus] = useState<Status>("idle");
  const [options, setOptions] = useState<FilterOption[]>([]);
  const [value, setValue] = useState<string[]>([]);
  const load = () => {
    setStatus("pending");
    setTimeout(() => {
      if (offline()) return setStatus("failure");
      setOptions(advisers);
      setStatus("success");
    }, 2000);
  };
  // The first press or key on the pill starts the request, before its list opens.
  const first = () => {
    if (status === "idle") load();
  };
  return (
    <div onPointerDownCapture={first} onKeyDownCapture={first} className="w-fit">
      <FilterPill
        label="Adviser"
        options={options}
        status={status}
        onRetry={load}
        value={value}
        onValueChange={setValue}
      />
    </div>
  );
}
```

### State precedence
- Pending and chosen: both show. The pill keeps its choice while the options load.
- Pending and failure: Not applicable: `status` is one value.
- Searching and chosen: both show. A chosen option that the search hides stays chosen and the pill still reads it.
- Single and searching: both show. Picking a match closes the list.
- Open and chosen: both show. The pill keeps its ink fill under the open list.
- Phone and open: phone wins. The pills are folded, so the sheet holds the lists.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| a list opens or closes | announce | `popup-motion`, `--t-pop` on `--curve`, from `Popover` | opacity | the fade stays |
| an option turns on or off | input | `--t-press` | the check's opacity | the same fade |
| rows dim while options load | announce | `--t-leave` on `--curve` | opacity | the same fade |
| the pill turns on | input | `pressable`, `--t-press` | background-color, color | the same colour change |

## Props

<!-- Props generated from registry/cobalt/ui/filter-bar.tsx with TypeScript by scripts/props-table.mjs -->
### FilterBar

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `filters` | `Filter[]` |  |  |
| `className?` | `string` |  |  |
| `clearable?` | `boolean` |  | Whether Clear is offered. |
| `done?` | `string` |  | The sheet's closing button, such as "Show 12 funds". |
| `labels?` | `Partial<{ chosen: (label: string, names: string[]) => string; others: (count: number) => string; search: (label: string) => string; noMatches: string; clear: string; clearAll: string; loading: string; failed: string; retry: string; filters: string; filtersOn: (count: number) => string; moreFilters: string; sheetDescription: string; done: string; }>` |  |  |
| `onClear?` | `() => void` |  | Clears every filter, and anything else the host counts as filtering, such as a search. |
| `search?` | `FilterSearch` |  | A search over the same list, drawn above the pills. |

### FilterList

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `label` | `string` |  | The filter's name: the search field's and the group's. |
| `onValueChange` | `(value: string[]) => void` |  |  |
| `options` | `FilterOption[]` |  |  |
| `value` | `string[]` |  |  |
| `clearRow?` | `boolean` | `true` | The Clear row under the options. |
| `close?` | `() => void` |  | Called after a single choice, so the popup that holds the list can close. |
| `labels?` | `Partial<{ chosen: (label: string, names: string[]) => string; others: (count: number) => string; search: (label: string) => string; noMatches: string; clear: string; clearAll: string; loading: string; failed: string; retry: string; filters: string; filtersOn: (count: number) => string; moreFilters: string; sheetDescription: string; done: string; }>` |  |  |
| `onRetry?` | `() => void` |  |  |
| `search?` | `boolean \| "auto"` | `"auto"` | A search field above the options; "auto" shows it once there are more than 8. |
| `single?` | `boolean` | `false` | One choice at a time: picking replaces the last and calls `close`. |
| `status?` | `Status` | `"idle"` | Options that load: pending dims them once the wait is worth admitting to. |

### FilterPill

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `label` | `string` |  | The filter's name: the search field's and the group's. |
| `onValueChange` | `(value: string[]) => void` |  |  |
| `options` | `FilterOption[]` |  |  |
| `value` | `string[]` |  |  |
| `className?` | `string` |  |  |
| `clearRow?` | `boolean` |  | The Clear row under the options. |
| `close?` | `() => void` |  | Called after a single choice, so the popup that holds the list can close. |
| `labels?` | `Partial<{ chosen: (label: string, names: string[]) => string; others: (count: number) => string; search: (label: string) => string; noMatches: string; clear: string; clearAll: string; loading: string; failed: string; retry: string; filters: string; filtersOn: (count: number) => string; moreFilters: string; sheetDescription: string; done: string; }>` |  |  |
| `onRetry?` | `() => void` |  |  |
| `search?` | `boolean \| "auto"` |  | A search field above the options; "auto" shows it once there are more than 8. |
| `single?` | `boolean` |  | One choice at a time: picking replaces the last and calls `close`. |
| `status?` | `Status` |  | Options that load: pending dims them once the wait is worth admitting to. |

`FilterBar` takes `filters`, each a `FilterList`'s props with a `key` and `more` for the ones that wait behind More filters, or, with `type: "range"`, a `RangeFilter`'s props, which draw its pill in the row and its fields, track and presets in the sheet, count as one choice while set (`filterCount`, `registry/cobalt/ui/filter-bar.tsx:310`) and clear to `[null, null]` (`clearFilter`, `registry/cobalt/ui/filter-bar.tsx:316`); `search`, a field above the pills with `value`, `onValueChange`, `label` (its name and placeholder) and `shortcut`, which makes "/" put the caret in it from anywhere on the page except a field, a menu, a list, a dialog or a page a dialog has made inert, never with Ctrl, Command or Alt held or while a key repeats or an input method composes, and shows the key at the field's end (`FilterSearchField`, `registry/cobalt/ui/filter-bar.tsx:346`; off by default, so two searches or a host that binds / do not fight); the row's Clear wraps together with the pill before it, so it never stands on a line of its own at any width (`registry/cobalt/ui/filter-bar.tsx:528`); `onClear` clears them and anything else the host counts, with `clearable` saying when, and without it Clear empties every filter and the `search`; `done` is the sheet's closing button, such as "Show 12 funds". The sheet's footer holds Clear all and then Done: stacked on a phone, Done under it by the thumb, and one row at the end from 640px up, Done last, as `rule/sheet-footer-row-from-640` asks of every sheet (`registry/cobalt/ui/filter-bar.tsx:576`; measured two stacked 400px buttons at 1440 before and Clear all 79px then Show 3 funds 114px in one row after, `.design-system/evidence/sheet/phone-sheet-family-2026-10-17.json`). `FilterPill` takes one filter's props. `FilterList` takes `label`, `options` (`value`, `label`, `count`), `value` and `onValueChange`, `single`, `search` (`"auto"` past 8 options, or a boolean), `status` and `onRetry`, `close` (called after a single choice), `clearRow` and `labels`. `filterSummary` returns the pill's words. `filterLabels` holds every string in English.

## Usage

### When to use
- A list of records a person narrows by several fields at once: funds by type and domicile, bookings by room and status.
- A field with a known set of values, a few or a few hundred, where a count per value helps choose.

### When not to use
- One filter of two to six choices that are always in view, such as Upcoming and Past. Use SegmentedControl instead.
- A free search over names. Use Input instead, with `type="search"`, beside the bar.
- Values from a server too many to list, such as every adviser. Use Combobox instead, which searches as you type.
- A filter of one on and off choice, such as Late filings. Use Pill instead.

### Rules
- `rule/filter-bar-pill-names-the-choice`: When a filter has a choice on, let the pill read the choice ("Hedge fund", or "Hedge fund +1") through `FilterPill` instead of a count ("Type, 2"), because the words say which filter is on without opening it, and the accessible name lists every choice. Evidence: principle heuristic: recognition rather than recall; single use `docs/system/examples/blocks/screener.tsx:946`, the screener's pills read their choices. Check: test `filter-bar.test.tsx` expects "Hedge fund +1" and the full list in `aria-label`.
  - Don't: `<Pill>Type, {chosen.length}</Pill>`
  - Do: `<FilterPill label="Type" options={types} value={chosen} onValueChange={setChosen} />`
- `rule/filter-bar-counts-are-facets`: When options carry a `count`, count the rows each option would show with the other filters as they are, instead of the rows it holds in the whole set, because a count that ignores the other filters promises rows the list will not show. Evidence: principle heuristic: visibility of system status; single use `docs/system/examples/blocks/screener.tsx:851-861`, each count runs the other filters first. Check: review of every `count`.
  - Don't: `count: funds.filter((f) => f.type === value).length`
  - Do: `count: matching(funds, { ...filters, type: [] }).filter((f) => f.type === value).length`
- `rule/filter-bar-same-list-in-headers`: When a DataTable column filters by a set of values, render `FilterList` in its `filter` instead of a control of its own, because the header menu then shows the same rows, counts and Clear as the pill above the table. Evidence: app 2/2 column filters in the examples use it, `docs/system/examples/data-table/filtered.tsx:63` and `docs/system/examples/filter-bar/in-data-table.tsx:31`. Check: review of every `filter`.
  - Don't: `filter: () => <div>{rooms.map((r) => <Pill key={r}>{r}</Pill>)}</div>`
  - Do: `filter: ({ close }) => <FilterList label="Room" options={rooms} value={room} onValueChange={setRoom} close={close} />`

### Content
- Follows `rule/writing-field-label-noun`.
- `rule/filter-bar-label-is-the-field`: When naming a filter, its `label` is the field's noun as the list's column calls it, such as "Domicile", instead of a question or a verb such as "Filter by domicile", because the label is the pill's text, the search field's name and the sheet's legend. Evidence: app 5/5 labels in the screener are column nouns (`docs/system/examples/blocks/screener.tsx:866-879`); person D11. Check: review.
  - Don't: `<FilterPill label="Choose a domicile" />`
  - Do: `<FilterPill label="Domicile" />`

### Anti-slop
- `rule/filter-bar-reset-holds-its-place`: When offering a way to turn every filter off, use `FilterBar`, which holds the `Clear` button's place while it is hidden, instead of rendering that button only once a filter is on, because a button that appears at the row's end can wrap the row and move the list below it. Evidence: person D37; measured the bar at 32px before and after a choice, `.design-system/evidence/filter-bar/measure.json`. Check: test `filter-bar.test.tsx` expects the hidden button to be `invisible`, not absent.
  - Don't: `{filtering && <Button variant="ghost" onClick={clear}>Clear</Button>}`
  - Do: `<FilterBar filters={filters} onClear={clear} clearable={filtering} />`

### Limits
- `rule/filter-bar-search-past-8`: When a filter has more than 8 options, leave `search` on `"auto"` instead of turning it off, because the list shows 7 rows of 38px in its 288px before it scrolls, and past that a person finds a value faster by typing. Evidence: measured 7 rows in view in a 288px list, `.design-system/evidence/filter-bar/measure.json`. Check: test `filter-bar.test.tsx` expects the search at 9 options and none at 8.
  - Don't: `<FilterPill label="Domicile" options={allDomiciles} search={false} />`
  - Do: `<FilterPill label="Domicile" options={allDomiciles} />`

## Accessibility
Rests on Base UI `Popover` through this registry, `Sheet`, and native buttons with the checkbox or radio role.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| Tab | before the bar | the pills in order, then More filters and Clear | a pill | by hand |
| Enter or Space | a pill | opens its list | the search field, or the first row | by hand |
| ArrowDown or ArrowUp | the search or a row | moves to the next or previous row, wrapping; from the search, to the first row | that row | by hand |
| Space or Enter | a row | turns the option on or off; with `single`, picks it and closes | the row; with `single`, the pill | by hand |
| Space or Enter | Clear in the list | turns every option off | the first row | by hand |
| Escape | the list | closes it | the pill | by hand |
| / | anywhere on the page but a field, a menu, a list or a dialog, with `search.shortcut` | puts the caret in the search and selects its text; inside a field it types a /, and with a popup open it does nothing | the search | by hand |

Measured at 1440: Enter on the Type pill put focus on its first row, ArrowDown moved to the second, Space turned options on, Escape returned focus to the pill named "Type: Private equity, Private credit". On the search example, / from the page focused the search with nothing typed in it; inside the search it typed a /; with the Assets popover open, and with Ctrl held, it did nothing; the key cap faded from 1 to 0 over three 16ms frames as the field took focus (`.design-system/evidence/filter-bar/range-search-2026-10-17.json`).

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| pill | button | its text, or `labels.chosen` ("Type: Hedge fund, Private equity") once something is chosen | `aria-haspopup="dialog"`, `aria-expanded` | the name and "collapsed" | test |
| list popup | dialog | the filter's `label` | none | the name on open | by hand |
| options | group, or radiogroup for `single` | the filter's `label` | `aria-busy` while pending | the name on entry | test |
| option | checkbox, or radio | its label and count | `aria-checked` | the label, the count and the state | test |
| search | searchbox | `labels.search`, "Search domicile" | none | the name | test |
| Clear row | button | "Clear" | `aria-disabled` until something is chosen | "Clear", "dimmed" when inert | test |
| failure | alert | "Could not load the options" | none | at once | test |
| bar search | searchbox | `search.label`, "Search funds" | `aria-keyshortcuts="/"` with `shortcut`; the key cap is `aria-hidden` | the name and the shortcut | test |
| phone pill | button | "Filters, 3 on" | `aria-haspopup="dialog"` | the name | by hand |

## Tokens
| Part | State | Token |
|---|---|---|
| pill | rest | `--control-sm`, `--r-lg`, `--muted`, `--foreground` |
| pill | chosen | `--foreground` fill, `--background` text |
| popup | open | `--popover`, `--r-3xl`, `--shadow-floating`, `--pad-popup` |
| option | hover and focus | `--accent`, `--accent-foreground`, `--r-lg` |
| count | all | `--muted-foreground` |
| check | on | `--primary-ink` |
| search | all | the Input's `--input` at 50 percent and `--r-lg` |
| skeleton | pending | the Skeleton's tokens |

Measured at 1440 and 390 (`.design-system/evidence/filter-bar/measure.json`): the pill 32px tall and rows 38px. Re-measured on the showcase at 1440 on 2026-10-17 after the popup corner became `--r-3xl`: the popup 256px wide with a 16px corner and 6px of padding, the search and the rows 6px in from its edge with a 10px corner, so both are concentric with it; on a phone the list sits in the bottom sheet at the sheet's padding.

## Related
- DataTable: the list the bar narrows; its column `filter` takes `FilterList`.
- Pill: one on and off filter.
- SegmentedControl: one of a few choices always in view.
- Combobox: a choice from a list too long to hold, searched on the server.
- Sheet: the panel that holds every filter on a phone.
- ResultCount: how many results a query found: exact, about, at least, or capped with a way past the cap.
- Slider: a value or a range picked along a track, with its bounds typed if needed.
