FilterBar

A compact toolbar that combines filter chips, a search input, and an optional sort dropdown. When the user starts typing with a non-"all" filter active, the chip row collapses and the active filter appears as a dismissible token inside the search field.

Demo

Filter chips on the left slide an animated underline to the active chip. When query is non-empty and a non-"all" filter is selected, the chips are replaced by a token pill inside the search field. Pressing Backspace on an empty input removes the token. Filter chips can carry a state color via accent — see the FilterOption.accent prop below.

all24running3failed2queued5done14

Search only

Omit filters and sortOptions to render just the search input.

Props

FilterBarProps

PropTypeDefaultDescription
querystringCurrent search query (controlled).
onQueryChange(q: string) => voidCalled when the user types or clears the input.
filtersFilterOption[]Filter chips rendered on the left. First option is treated as "all". Omit to hide chips.
filterValuestringActive filter value (controlled).
onFilterChange(value: string) => voidCalled when a chip is clicked or the token is dismissed.
placeholderstring'search'Placeholder text for the search input.
searchRefRefObject<HTMLInputElement>Forward ref to the underlying input element.
sortOptions{ value: string; label: string }[]Options for the sort dropdown. Omit to hide the dropdown.
sortValuestringActive sort value (controlled).
onSortChange(value: string) => voidCalled when the sort selection changes.
classNamestringExtra classes on the root wrapper.

FilterOption

FieldTypeDescription
valuestringUnique identifier for this filter.
labelstringDisplay text shown in the chip and as the token label.
countnumberItem count shown as a superscript next to the label.
accentstringTint color applied when count > 0. Prefer palette tones — var(--tone-green) (running/ok), var(--tone-red) (failed/error).