API reference

createFilters

Bind project constants and get a configured useFilters, resolveFilterParams, and helpers.

createFilters(config?) => {
  useFilters,
  resolveFilterParams,
  defineFilters,
  f,
  toDateValue, fromDateValue,
  toDateTimeValue, fromDateTimeValue
}

Call it once per project (or per API convention) and export the result. See Sharing setup.

Top-level config

OptionDefaultDescription
defaultCommit'instant'Fallback commit mode for every filter. See Values & commits.
arraySeparator','Delimiter for array-shaped params (multiSelect, tags, ranges) in the URL.
paginationPagination keys and defaults (below).
dateDate (de)serialization (below).
requestHow params are shaped for a backend request (below).
createFilters({ arraySeparator: '|' });
// tags: ['a', 'b', 'c']  ↔  ?tags=a|b|c

request

Per-API request conventions — a constant like date and pagination. Governs the params object the hook and resolveFilterParams produce.

OptionDefaultDescription
arrayFormat'array'Array-shaped params as a JS array ('array') or an arraySeparator-joined 'string'.

Most backends expect array values as a comma-separated string. Set request.arrayFormat: 'string' and params hands you exactly that — no mapping before a request. Only params changes; filters / filterMap still expose arrays for your UI, and the type of params updates to match (array kinds become string).

const { useFilters } = createFilters({ request: { arrayFormat: 'string' } });
// tags: ['a', 'b']  →  params.tags === 'a,b'   (typed as string)

pagination

OptionDefaultDescription
pageKey'page'URL key for the page number, and its key in params.
perPageKey'per_page'URL key for the per-page count, and its key in params.
firstPage1The number the first page counts from. 0 for a 0-indexed API.
defaultPerPage10Per-page count assumed when the URL has none.
resetPageOnFilterChangetrueWhether changing a filter resets the page. See Pagination.

date

Override in inverse pairs to change how dates are stored. See Custom date formats.

OptionDefaultDescription
serializefixed yyyy-MM-ddDate → stored string.
parsefixed yyyy-MM-ddStored string → Date.
serializeDateTimefixed yyyy-MM-ddTHH:mm:ssDatetime counterpart of serialize.
parseDateTimefixed yyyy-MM-ddTHH:mm:ssDatetime counterpart of parse.

Returned helpers

  • useFilters, resolveFilterParams, defineFilters — bound to this config. See their own pages.
  • f — the builders, re-exported for convenience.
  • toDateValue / fromDateValue and the *DateTime pair — Date ↔ stored string using this config's date (de)serialization.

On this page