Content
- Options are short nouns, sentence case.
A pill that opens a single-choice filter menu, for table toolbars.
import { … } from "@brdgapp/ui/components/filter-pill"FilterPill is a pill that opens a short single-choice menu, for the right end of a table toolbar: search on the left, filters on the right. The first option is the resting "All" state; choosing anything else fills the pill, so an active filter is visible at a glance. The usual mistake is a filter that's on but looks off.
Pill. Shows the current choice and a chevron. Filled when not "All".
Menu. At least 200px wide, aligned to the pill's right edge. The chosen option is bold with a blue check.
Search on the left, filter on the right.
| Rest | Hover | Focus | |
|---|---|---|---|
| Resting | |||
| Active |
| State | What happens |
|---|---|
| Resting | Clear pill, muted label: the first option is chosen. |
| Active | Filled pill, dark label: another option is chosen. |
| Open | Chevron flips. |
onChange. Filter on the server so pagination stays correct.Do
Make the first option say what "no filter" means: "All degrees".Don't
Leave the resting label as just "Filter".ariaLabel naming what is filtered.| Keys | Action |
|---|---|
| EnterSpace↓ | Open. |
| ↑↓ | Move between options. |
| Enter | Choose. |
| Esc | Close without changing. |
FilterPill
The pill and its menu.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | The chosen option. |
options | { value, label }[] | — | The first is the resting "All" state. |
onChange | (value) => void | — | Called with the new choice. |
ariaLabel | string | "Filter" | What is being filtered. |
className | string | — | Layout only. |
…other attributes | id, aria-*, data-*, event handlers | — | Passed to the button. The component's own props win where they overlap. |
What it's built from and where it's used, read from the code. When you change it, check these too.
Where the code still differs from the system. Follow the system, not the gap.
components.md → FilterPill, DegreeFilterPill; src/components/ui/filter-pill.tsx.