Filter popover
On a branch in the appPort of Ui::FilterPopoverComponent from roastertools-app's origin/jon-dev-3250-shared-list-controls branch (app/components/ui/filter_popover_component.{rb,html.erb}). Grouped filter popover: a trigger with an active-filter count, a category rail, one panel per category and a Reset/Apply footer. On a phone (below sm, 2026-10-15) the trigger goes icon-only and opens a sheet instead — the categories as a drill-in list showing what each has set, the fields one level down, Apply pinned to the foot — after Shopify admin's "Filter by" (see the HANDOFF note). In the app the whole body is one GET form; pages own the fields, hidden parameters and the Reset control. Classes are the branch's verbatim, respelled: tw- stripped; border-0 border-solid dropped; sizes by pixel at the app's 14px root (conflict 13): text-base → text-ui-sm, text-sm → text-ui-xs, text-xs → text-ui-xs; gray-200 → stone-200; stone-800 → stone-dark (same value); hover:bg-opacity-90 → hover:bg-navy/90; tw-shrink-0 → shrink-0 (a Tailwind 3 name the branch uses; 2.2 spells it flex-shrink-0); the legacy tw-button-brutalist-primary Apply → Button primary. Stimulus dropped for React state: data-controller="filter-popover" with its category and panel targets, click->filter-popover#selectCategory, and the active/inactive classes (FILTER_CATEGORY_ACTIVE_CLASSES / FILTER_CATEGORY_INACTIVE_CLASSES, which the controller swaps). The trigger's data-popover-target="trigger" / click->popover#toggle and its aria-expanded/aria-controls/aria-haspopup are what Radix sets on the trigger. Rails form plumbing (url, hidden_fields, form_data, the submit) → onApply; the reset slot stays a slot and the default Reset button calls onReset. The panel is a sm: grid (rail 4 columns, content 8), so at 390 the rail stacks above the content as a wrapping row of category chips.
App: Ui::FilterPopoverComponent (origin/jon-dev-3250-shared-list-controls)
Three categories
#defaultIdle trigger (white, stone-dark border). Open it: the rail lists Status, Customer and Dates with their light icons; the first is active (navy) and shows its chevron, and clicking another swaps the panel. The panel is a sm: 12-column grid (rail 4, content 8). Below sm the trigger opens the phone sheet instead (see the next preview). Reset is the default button; Apply is a primary Button that submits and closes.
On a phone: the sheet
#sheetBelow sm (forced here with presentation="sheet") the trigger is icon-only and opens a sheet nearly the screen's height, after Shopify admin's "Filter by": close and Reset in the header, the categories as a list you drill into, Apply pinned to the foot. Tick a status, go back, and the category shows what is set in navy (the canon's "chosen"). Every panel stays mounted while the sheet is open, so values hold across categories. Focus is trapped and Escape closes, as a modal's are.
Two filters active
#activeactive_count above zero turns the trigger navy with white semibold text and adds the white count chip. The page computes the count from its applied filters.
Reset as the page's link
#custom-resetThe reset slot replaces the default button with the page's own control, here a link to the bare list path using FILTER_RESET_CLASSES. Whatever goes in the slot closes the panel when clicked.
Props
| Name | Type | Default | Notes |
|---|---|---|---|
| id | string | — | Required. The popover id (the app's aria-controls target and data-filter-popover hook) |
| trigger_label | string | — | Required. Text on the trigger button |
| categories | FilterCategory[] | — | Required. One rail entry per key ({ key, label, icon }); icon is a vendored Font Awesome name rendered light. The first is active by default |
| panels | Record<string, FilterPanel> | — | Required. One panel ({ heading, content }) per category key; the page's fields go in content. A missing key renders no panel, as in the app |
| apply_label | string | "Apply" | Text on the submit Button |
| active_count | number | 0 | Number of active filters; above zero the trigger goes navy and shows the count chip |
| reset | ReactNode | — | The page's Reset control (a link to the bare list path using FILTER_RESET_CLASSES, or a button using FILTER_RESET_BUTTON_CLASSES). Without it a default Reset button renders. Either closes the panel when clicked |
| onApply | () => void | — | Mock behaviour: the app submits the GET form. Called on Apply, then the panel closes |
| onReset | () => void | — | Mock behaviour: called by the default Reset button, then the panel closes |
| presentation | auto | sheet | auto | Lookbook only: sheet forces the phone sheet at any width. Pages leave it to the width: below sm (639px) the trigger opens a sheet instead of the popover (2026-10-15) |
| className | string | — | On the relative wrapper <div> |
| FilterClose | component | — | Wraps a control in a panel that applies at once (a quick view) so it closes the panel after its own click, popover or sheet. Replaces PopoverClose inside panels, which closed nothing in the sheet |