Skip to content
GitHub (opens in a new tab)

FilterBar

A row of filter chips with add, clear all, and an overflow menu when the row is too long.

stableMoleculecontracts/filterbar.json

Preview

FilterBar

A row of filter chips, with an optional leading search. Add a filter, open one, or clear them all. Extra chips collapse into a +N menu. On a narrow screen the row can fold into a Filters chip that opens a sheet.

Master

Each chip is a FilterButton. Clear all shows up once a filter has a value or a count.

Usage

One chip is FilterButton. The bar owns the row, the overflow menu, Add filter, and Clear all.

Do's

  • Several filters above a table or list
  • The person adds a filter, clears them all, or opens one chip

Don'ts

<FilterBar filters={filters} onFilterClick={openFilter} onAdd={addFilter} onClear={clearFilters} maxVisible={3} />

When to use

  • Several filters above a table or list
  • The person adds a filter, clears them all, or opens one chip

When not to use

  • One filter chip — use FilterButton
  • Search inside a table — use DataTable
  • Page actions — use Button

What an agent reads

import { FilterBar } from "agentic-ds-kit";
must
  • The row is a group labelled Filters, or ariaLabel
  • Each chip is a kit FilterButton
  • Overflow is a menu of the hidden filters, opened from a +N trigger with a chevron like the chips
  • With renderOptions, a chip opens a kit Popover (aria-haspopup=dialog) that Escape and a click outside close
  • Clear all is a button, present only when a filter is set
  • With renderSheet on a narrow bar, the Filters chip names the applied count (never colour alone) and opens a Drawer labelled Filters, or ariaLabel. Escape and Close dismiss it. Apply is the only primary
defaults
  • addLabel Add filter
  • clearLabel Clear all
  • size md
  • applyLabel Apply
  • ariaLabel Filters
stops if
  • Do not invent a local chip — chips are FilterButton
  • Do not invent an overflow chip — overflow is kit DropdownMenu
  • Do not use raw hex
  • Do not build a local filter sheet — renderSheet opens kit Drawer

From contracts/filterbar.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
filtersarrayYes—Each item is { id, label, value?, count? }.
openIdstringNo—Which chip's options are open.
onFilterClickfunctionNo—(id: string) => void
renderOptionsfunctionNo—(id: string) => ReactNode. Options for one filter. When set, each chip opens them in a kit Popover anchored to the chip; openId and onFilterClick still say which one is open.
onClearfunctionNo—Clear all. Shown when a filter has a value or count.
onAddfunctionNo—Shows Add filter when set.
addLabelstringNoAdd filter—
clearLabelstringNoClear all—
maxVisiblenumberNo—Extra chips collapse into a +N menu.
sizemd | sm | lgNomdChips and buttons share the 32 / 36 / 40 control scale.
leadingslotNo—First in the row, before the chips. A kit Combobox or search Input.
renderSheetfunctionNo—() => ReactNode. The same fields stacked for a narrow screen. When set, a bar narrower than --grid-breakpoint-sm shows one Filters chip with the applied count; it opens these in a bottom kit Drawer with Clear all and Apply.
onApplyfunctionNo—Apply in the sheet. The sheet closes after it.
applyLabelstringNoApply—
ariaLabelstringNoFilters—
  • Component
    →

    FilterButton

    Filter chip for lists and tables: shows the filter name or its chosen value, opens its options, and turns an applied filter on or off.

  • Component
    →

    DataTable

    Framed dataset with search, filters, column settings, and a caption title.

  • Component
    →

    Button

    Clickable action control with appearance × mode (plus an optional flat set) and a fixed set of sizes.

  • Component
    →

    DropdownMenu

    Actions or value menu from a button, field, or nav trigger.