Acronis UIKit
Components

FilterSearch

A composable data-table toolbar — search, a tenant switcher, a filter popover, and applied-filter chips.

Usage

import {
  FilterSearch,
  FilterSearchActions,
  FilterSearchFilters,
  FilterSearchAppliedFilters,
  useFilterSearchFilters,
} from '@acronis-platform/ui-react';

FilterSearch is a composable toolbar for data tables: a horizontal row that arranges a search field, an optional tenant/scope switcher, an optional filter popover, and trailing action buttons. It's a pure layout wrapper — you place Search, Select, FilterSearchFilters, and FilterSearchActions as direct children.

FilterSearchFilters is the real filter popover: a trigger button that opens a form (Reset filters / Cancel / Apply) over a draft copy of the applied filters. It snapshots value on open, lets field children mutate the draft, and commits the current draft through onValueChange and optional onApply when Apply is pressed. Apply is enabled as soon as the panel opens, including when the draft is empty or unchanged. Cancel, Escape, and outside-press revert the draft. Fields that don't fit the popover's height scroll internally. Select dropdowns and date-range calendars opened from filter fields use the kit's standard popup shadow (--ui-shadow-md).

Any prop it doesn't consume itself is forwarded to the trigger button, so data-testid, id, disabled, and aria-* land on the real <button> (className is merged onto it too). The footer labels (resetFiltersLabel, cancelLabel, applyLabel) and the trigger label are overridable for localization. side, align, sideOffset, contentClassName, portalContainer, collisionBoundary, and positionMethod are forwarded to the underlying PopoverContent for consumers who need to configure the popover directly — portalContainer/positionMethod matter mainly when the toolbar renders inside a constrained MFE/Shadow DOM mount (see the Popover docs).

FilterSearchAppliedFilters renders the currently applied filters as removable chips, plus a top-level Reset filters action that clears everything immediately (no popover involved). It's a separate component, rendered as a sibling row below FilterSearch, and renders nothing when there are no chips to show. By default, each field gets one chip. Labels use "<key>: <value>", with arrays joined by ", " and objects formatted as JSON when possible.

Pass splitFilterKeys={['type']} to show one chip per selected type. For { type: ['partner', 'folder'] }, removing the Partner chip leaves { type: ['folder'] }. Removing the last type drops the field key. Empty arrays in opted-in fields contribute no chips.

getFilterChipLabel(key, value) receives the individual value for a split chip and the entire field value for a grouped chip. Localize the remove button with getRemoveFilterValueLabel(key, value) for split chips and getRemoveFilterLabel(key) for grouped chips. The default remove button for a split chip uses its text label when available. Supply the split formatter to give a rich label a descriptive accessible name. The row's resetFiltersLabel is independent from the popover's label.

Filter fields are supplied as plain children inside FilterSearchFilters. Each field wires itself to the draft with the useFilterSearchFilters() context hook, which returns the current draft filters map and a per-key setFilter setter:

function StatusField() {
  const { filters, setFilter } = useFilterSearchFilters();
  return (
    <InputSelect
      value={(filters.status as string) ?? 'all'}
      onValueChange={(value) =>
        setFilter('status', value === 'all' ? undefined : value)
      }
    >
      {/* … */}
    </InputSelect>
  );
}

Calling setFilter(key, undefined) deletes that key from the draft instead of storing a literal undefined. Route a field's "all"/"any" option through it, as above — an unset filter is the absence of a key, so it stays out of the applied set and out of the chip row rather than showing a status: undefined chip that can't be cleared.

Group fields with layout elements as needed. Calling useFilterSearchFilters() outside a <FilterSearchFilters> popover throws.

Need a filter popover outside a FilterSearch toolbar? See the Filter popover pattern for the hand-rolled Button + Popover + InputSelect composition.

Design-pending. FilterSearch/FilterSearchActions have a real Figma node (see the API reference below), and FilterSearchAppliedFilters's chip row now does too — it landed as its own FilterChips component, which FilterSearchAppliedFilters renders through. FilterSearchFilters still has no node: it themes entirely from shared semantic tokens plus its composed components' own tiers (Button, Popover), and will be reconciled against the real design once a mockup lands.

Examples

The toolbar below enables per-value chips for the Type field. Try removing one type in the demo, then reopen the filter popover to see the remaining selection.

function ClientFilterFields() {
  return (
    <>
      <TypeField />
      <PricingModeField />
      <StatusField />
      <PeriodField />
    </>
  );
}

function Toolbar() {
  const [filters, setFilters] = useState<Record<string, unknown>>({
    type: ['Partner', 'Folder'],
  });

  return (
    <div className="flex flex-col gap-3">
      <FilterSearch>
        <Select defaultValue="acme">
          <SelectTrigger className="w-56">
            <SelectValue placeholder="All customers" />
          </SelectTrigger>
          <SelectContent>{/* … */}</SelectContent>
        </Select>
        <InputSearch
          placeholder="Enter text to filter"
          aria-label="Search"
          className="w-56"
        />
        <FilterSearchFilters
          value={filters}
          onValueChange={setFilters}
          label="Table filters"
        >
          <ClientFilterFields />
        </FilterSearchFilters>
      </FilterSearch>
      <FilterSearchAppliedFilters
        filters={filters}
        splitFilterKeys={['type']}
        onValueChange={setFilters}
      />
    </div>
  );
}

Search-only, no tenant switcher or filters:

<FilterSearch>
  <InputSearch
    placeholder="Search table"
    aria-label="Search"
    className="w-56"
  />
</FilterSearch>

With trailing action buttons:

<FilterSearch>
  <InputSearch
    placeholder="Search table"
    aria-label="Search"
    className="w-56"
  />
  <FilterSearchFilters value={filters} onValueChange={setFilters} />
  <FilterSearchActions>
    <Button>Export</Button>
  </FilterSearchActions>
</FilterSearch>

API Reference

Prop

Type

Prop

Type

Prop

Type

Prop

Type

The useFilterSearchFilters() hook returns the current draft filters map and a setFilter(key, value) setter for wiring filter-field children to the popover draft — passing undefined as the value drops the key from the draft.

Edit on GitHub

On this page