FilterBar

The toolbar row for a table or report, with its filters. Search or tabs sit on the left; filters and a Download button sit on the right. You declare each filter, and Helix draws it, keeps the panel's unapplied changes, and counts the active ones, so a team no longer keeps two copies of filter state. FilterBar replaces FilterPopover, which is deprecated, and the never-built FilterCard.

Spec · from metadata

When to use

  • •Filtering a table or list page
  • •Filtering a report or analytics dashboard
  • •Any toolbar row that also holds search, tabs or a Download button

When not to use

  • •Search alone — an `Input` or `InputGroup` in the start slot of `FilterBar`, or on its own, is enough
  • •Sorting — it is a separate control, not a filter
  • •Filters scoped to a card inside a page — they belong to that card's header, not the page toolbar

Required companions

Environmental prerequisites this component needs beyond its props. Supply these or it won't work as expected — TypeScript won't catch a missing one.

CompanionKindWhy
window.matchMediatest-shimuseIsMobile calls matchMedia, which jsdom lacks — mock it (matches: false = desktop) or tests throw. Matches true renders the phone bottom sheet.
ResizeObservertest-shimFilterBar measures the row with a ResizeObserver to decide whether the filters fit. Where it is missing (jsdom) FilterBar does not throw and stays in the row form. Stub it only if you need to exercise measuring; jsdom has no layout, so the row never folds for lack of room.

Variants

PropValuesDefaultDescription
applyliveservernone (required)live: every change applies at once, and the panel has no Apply button. server: the panel is a draft that only Apply commits. Row filters apply on pick in both.

Anti-patterns

Avoid<div className="flex items-center gap-2">
  <Select value={term} onValueChange={setTerm}>
    <SelectTrigger>
      <span>Term:</span>
      <SelectValue />
    </SelectTrigger>
    <SelectContent>...</SelectContent>
  </Select>
</div>
Prefer<FilterBar apply="live">
  <FilterBarSelect
    label="Term"
    value={term}
    onValueChange={setTerm}
    options={termOptions}
  />
</FilterBar>

FilterBar draws both looks of a filter, the row trigger with its label inside and the panel field with its label above. A hand-built trigger drifts from them, and it cannot fold into the panel when the row runs out of room.

Avoid<FilterBar apply="live">
  <TermFilter />
  <CampusFilter />
</FilterBar>
Prefer<FilterBar apply="live">
  <FilterBarSelect label="Term" ... />
  <FilterBarSelect label="Campus" ... />
</FilterBar>

FilterBar reads its children to decide the layout, so a FilterBarSelect wrapped in a team component is not found and silently disappears. Put every field directly inside FilterBar; fragments are flattened.

Avoid<FilterPopover triggerLabel="Filters" activeCount={activeCount} onApply={...} onClear={...}>
  ...
</FilterPopover>
Prefer<FilterBar apply="server">
  <FilterBarSelect ... />
</FilterBar>

FilterPopover is deprecated and removed at 1.0. Filters sit in the toolbar row or a push-down panel, never a popover. FilterBar also keeps the draft and the count, so the team's draft/applied state goes away.

Accessibility

  • Required ARIAaria-expandedaria-controls
  • Screen readerThe Filter button announces whether the panel is open (aria-expanded) and points at the desktop panel with aria-controls (undefined on phones, where the Sheet is a dialog); the active count is read inline after the label. Each row trigger's name contains its label and its value ('Term: Fall 2026'); there is no aria-label, because it would hide the value. The panel is a region labelled 'Filters'. The hidden copy FilterBar measures is aria-hidden.
  • ContrastRow labels and panel labels use muted-foreground on the page or card surface, which meets WCAG AA. The open Filter button changes to the accent background with the same foreground.

Token bindings

TokenCategoryUsage
cardcolorThe panel surface (from Card) and the phone sheet
muted-foregroundcolorThe label inside a row trigger and the label above a panel field
accentcolorThe Filter button's background while the panel is open
3 (12px) / 4 (16px)spacingGap between row items and panel padding / gap between panel fields
Recent changes
  • new

    FilterBar: one filter row for tables and reports

    2026-10-30

[!NOTE] Compound component — an opinionated composition of Helix primitives. Composes: Select, Button, Badge, Card, Label, Sheet.

Import

import {
  FilterBar,
  FilterBarStart,
  FilterBarActions,
  FilterBarSelect,
  FilterBarField,
} from "@timelycare/helix-ui"

Usage

const [term, setTerm] = useState("fall-2026")
const [campus, setCampus] = useState("all")

<FilterBar apply="live">
  <FilterBarStart>
    <InputGroup className="w-64">
      <InputGroupAddon><Search /></InputGroupAddon>
      <InputGroupInput aria-label="Search members" placeholder="Search members" />
    </InputGroup>
  </FilterBarStart>

  <FilterBarSelect
    label="Term"
    value={term}
    onValueChange={setTerm}
    options={[
      { value: "fall-2026", label: "Fall 2026" },
      { value: "spring-2026", label: "Spring 2026" },
    ]}
  />
  <FilterBarSelect
    label="Campus"
    value={campus}
    onValueChange={setCampus}
    options={[
      { value: "all", label: "All campuses" },
      { value: "north", label: "North" },
    ]}
  />

  <FilterBarActions>
    <Button variant="outline"><Download /> Download</Button>
  </FilterBarActions>
</FilterBar>

Every field is controlled, so you own the values and can keep them in the URL. The "All campuses" option needs a real value such as "all", because Radix rejects an empty string. Fields, FilterBarStart and FilterBarActions must be direct children of FilterBar. Fragments are fine. FilterBar reads its children to lay itself out, so a field wrapped in your own component is not found and silently disappears. Any other direct child, such as a bare search input, renders in the start slot.

With ListPageTemplate, set hideSearch and put the search in FilterBarStart, so there is one toolbar row.

Row or panel

Each filter has two looks, and FilterBar chooses between them. In the row, a filter is a trigger with its label inside it ("Term: Fall 2026"). In the panel, it is a label above a full-width control.

The filters fold into the panel when any of these holds:

  • There are more than three of them.
  • Any of them is a FilterBarField, which can only be drawn in the panel.
  • The row look does not fit. FilterBar measures the room left after the start slot and the actions, so a table page with a wide search field folds sooner than a report page with tabs.

Folded, the filters become one outline Filter button with a funnel icon, the count of active filters, and a chevron. Opening it shows a white card panel directly below the row, spanning its width and pushing the content under it down. The row itself never wraps, and the start slot and actions stay put.

On phones, the bar is always folded, and the Filter button opens a bottom sheet instead of the panel. The fields stack one per row, and the footer stays pinned.

The count is derived from the applied values, never from unapplied changes in the panel, so it always matches what is filtering the data.

Applying filters

Row filters apply the moment you pick a value, in both modes. A pick from a dropdown is already one deliberate action, so the row has no Apply button. The apply prop decides what the panel does.

Row filterPanel or sheet: livePanel or sheet: server
Pick a choiceonValueChange nowonValueChange nowUpdates the draft only
Apply—Not shownCalls onValueChange once for each field whose draft differs, then closes. Disabled when nothing differs.
Clear all—Each active field → clearValue, nowDraft → every clearValue; still needs Apply (same as FilterPopover)
Close without Apply——Draft discarded

Use apply="server" when changing a filter fetches data, so a person can set several filters and send one request. Use apply="live" for client-side data under about 500 rows, where each change can apply at once. FilterBar needs you to say which, so no list gets one behaviour by accident.

In server mode the draft holds only what you changed in the panel; a field you did not touch keeps following its current value, so a change made from outside while the panel is open is never reverted. Apply reports every change together, inside one click handler, so React batches them into one render and a team fetching from these values in an effect fetches once. On phones, the live-mode footer says "Done", since there is nothing to apply but the sheet still needs a visible close.

Loading states and result announcements belong to the list, not the bar. Keeping the filters in the URL belongs to your page, which can do it because every field is controlled. Route values through React state and never write one URL update per field: Apply and live Clear all report several fields in one handler, and setSearchParams and router.replace don't queue, so the last write wins. See helix-data-patterns references/filter-bar.md.

Unusual filters

A filter that is not a plain dropdown, such as a date range, uses FilterBarField. It takes a label, value, onValueChange, a required clearValue (there is no options list to take a default from), and a render function that draws your control. The function receives { value, onValueChange, id, labelId }: point aria-labelledby at labelId when the control has no label of its own, and use id as its id. isActive defaults to !Object.is(value, clearValue), so pass it when the clear value is an object or array, which Object.is compares by identity.

<FilterBarField
  label="Date range"
  value={range}
  onValueChange={setRange}
  clearValue={null}
>
  {({ value, onValueChange, labelId }) => (
    <Calendar
      mode="range"
      aria-labelledby={labelId}
      selected={value ?? undefined}
      onSelect={(next) => onValueChange(next ?? null)}
    />
  )}
</FilterBarField>

A FilterBarField is drawn in the panel only, because an arbitrary control has no "Label: value" row look. Adding one therefore folds the whole bar behind the Filter button. In a server-mode panel, the render function receives the draft value, and Helix holds the draft without knowing what the control is. Reach for it when FilterBarSelect cannot express the filter, not to restyle a dropdown.

Migrating from FilterPopover

FilterPopover is deprecated. It keeps working and is removed at 1.0. The migration deletes code: FilterBar holds the draft, so the team's draft and applied state goes away.

Before, with five fields in a popover:

const [draft, setDraft] = useState(DEFAULTS)
const [applied, setApplied] = useState(DEFAULTS)
const activeCount = Object.entries(applied).filter(([k, v]) => v !== DEFAULTS[k]).length

<FilterPopover
  activeCount={activeCount}
  onApply={() => setApplied(draft)}
  onClear={() => setDraft(DEFAULTS)}
>
  <Label>Term</Label>
  <Select value={draft.term} onValueChange={(v) => setDraft({ ...draft, term: v })}>…</Select>
  <Label>Campus</Label>
  <Select value={draft.campus} onValueChange={(v) => setDraft({ ...draft, campus: v })}>…</Select>
  {/* … visit type, group and provider type, the same again */}
</FilterPopover>

After, with the draft state deleted:

const [term, setTerm] = useState("fall-2026")
const [campus, setCampus] = useState("all")
const [visitType, setVisitType] = useState("all")
const [group, setGroup] = useState("all")
const [providerType, setProviderType] = useState("all")

<FilterBar apply="server">
  <FilterBarSelect label="Term" value={term} onValueChange={setTerm} options={termOptions} />
  <FilterBarSelect label="Campus" value={campus} onValueChange={setCampus} options={campusOptions} />
  <FilterBarSelect label="Visit type" value={visitType} onValueChange={setVisitType} options={visitTypeOptions} />
  <FilterBarSelect label="Group" value={group} onValueChange={setGroup} options={groupOptions} />
  <FilterBarSelect label="Provider type" value={providerType} onValueChange={setProviderType} options={providerTypeOptions} />
</FilterBar>

Use apply="server" where the popover's Apply button fetched data, and apply="live" where it only narrowed rows already on the page. Search moves out of the popover's neighbourhood into FilterBarStart, and a Download button into FilterBarActions. Do not add your own Apply button or count badge: FilterBar draws both.

TimelyCare Design System

v0.14.0