API reference

Types

ResolvedFilter, FilterOption, and the other exported types.

The package exports the types you need to write your own controls and helpers. The most important is ResolvedFilter — the shape of each item in filters / filterMap.

ResolvedFilter

A resolved filter is your config plus live value, handlers, and state. It's a discriminated union on type, so a switch (filter.type) narrows to the exact variant (filter.options under 'select', filter.loadOptions under 'asyncSelect').

Value & handlers

FieldDescription
keyThe config key (and URL param name).
typeThe filter kind ('text', 'select', …).
label, placeholderYour label; placeholder defaults to it.
valueThe draft value — what the control shows now.
onChange(value) => void — set this filter's value.
resetBack to default (respects commit). instantReset bypasses commit.
apply, cancelCommit / discard this filter's pending change.

State

FieldDescription
committedValueWhat's actually in params/the URL. Equals value unless dirty.
isDirtyThis filter has an uncommitted change.
isFilteredCommitted value differs from default. isFilteredDraft for the draft.
commitEffective mode: 'instant', { debounce }, or 'manual'.
isInstant / isDebounced / isManualBooleans for the effective mode.
debounceMsThe delay when debounced, else null.

Type-specific extrasoptions and selectedOption(s) on choice filters; loadOptions, onSelectOption / onToggleOption / onSetOptions on async filters.

FilterOption

interface FilterOption<V = FilterPrimitive> {
  label: string;
  value: V;
  count?: number; // e.g. facet counts
  meta?: FilterOptionMeta; // your augmented hints
}

Other exports

TypeUse
AnyUseFiltersReturnProp type for pass-through components. See Placement.
UseFiltersReturn, UseFiltersOptionsThe hook's return and options.
FilterConfig, FiltersConfigA single config / a config map.
FilterMeta, SelectFilterMeta, FilterOptionMeta, FiltersMetaAugment for UI metadata.
ResolvedFilterOf<'select'>Narrow ResolvedFilter to one kind.
FilterValue, FilterParams, PaginationParamsValue/param helper types.
FiltersFor<P, PP?, AF?>Constrain a config to an API params type. Pass your pagination params + arrayFormat if you customized them — it can't read your factory. See Typed params.

On this page