[!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 filter | Panel or sheet: live | Panel or sheet: server | |
|---|---|---|---|
| Pick a choice | onValueChange now | onValueChange now | Updates the draft only |
| Apply | — | Not shown | Calls onValueChange once for each field whose draft differs, then closes. Disabled when nothing differs. |
| Clear all | — | Each active field → clearValue, now | Draft → 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.