Skip to content
Eskais UI

Server data

Filter Schema

Typed filters declared once: defineFilters with text, options, boolean, number, date, dateRange and remoteOption fields, FilterValues inferred from it, a canonical AST, serializers for query params, JSON and q-only search, and a URL codec that round-trips readable params. Backend query languages are items of their own: filter-rsql, filter-odata, filter-spring and filter-graphql.

Example

Request
filter=status=in=("open","blocked");amount=ge=100;created=ge="2026-01-01";created=le="2026-01-31"

Installation

npx shadcn@latest add @eskais/filter-schema
Brings alongnarrowpage-source

The example also uses the filter-rsql, filter-odata, filter-spring, filter-graphql adapters:

Example adapters
npx shadcn@latest add @eskais/filter-rsql @eskais/filter-odata @eskais/filter-spring @eskais/filter-graphql

Adapters

Each adapter is an item of its own that brings filter-schema along. Install only the ones your backend needs.

  • Filter RSQL

    filter-rsql
    npx shadcn@latest add @eskais/filter-rsql
  • Filter OData

    filter-odata
    npx shadcn@latest add @eskais/filter-odata
  • Filter Spring

    filter-spring
    npx shadcn@latest add @eskais/filter-spring
  • Filter GraphQL

    filter-graphql
    npx shadcn@latest add @eskais/filter-graphql

Usage

Import
import {  assertFieldName,  assertLeaf,  epochOf,  fieldsOf,  FilterSerializeError,  filterOps,  formatDate,  hasGroups,  isLeaf,  isTemporalLike,  matchesFilter,  negate,  readPath,  scalarText,  valuesOf,} from "@/lib/filter-ast"import {  activeFilterKeys,  defineFilters,  isActiveValue,  isDateInput,  isDateRange,  isNumberFilter,  isNumberOp,  remoteOption,  schemaFields,  searchFieldOf,  searchOf,  searchTerms,  toFilterAst,  wireName,} from "@/lib/filter-schema"import { andLeaves, checked, jsonAst, queryParams, searchOnly, walkLeaves } from "@/lib/filter-serializers"import { createUrlCodec } from "@/lib/filter-url"import { findFilterKey, parseFilterInput } from "@/lib/filter-input"

Declare the filters once; the same schema types the values, drives the filter UIs, writes the URL and serializes the request. A backend query language (RSQL, OData, Spring Filter, GraphQL) is an adapter item: install only the one your server reads.

API reference

This item exports functions and types rather than components.

Other exports

assertFieldNameassertLeafepochOffieldsOfFilterSerializeErrorfilterOpsformatDatehasGroupsisLeafisTemporalLikematchesFilternegatereadPathscalarTextvaluesOfactiveFilterKeysdefineFiltersisActiveValueisDateInputisDateRangeisNumberFilterisNumberOpremoteOptionschemaFieldssearchFieldOfsearchOfsearchTermstoFilterAstwireNameandLeavescheckedjsonAstqueryParamssearchOnlywalkLeavescreateUrlCodecfindFilterKeyparseFilterInputtype DateFormattype FilterLeaftype FilterNodetype FilterOptype FilterScalartype TemporalLiketype BooleanFieldtype DateFieldtype DateInputtype DateRangetype DateRangeFieldtype FieldValuetype FilterFieldtype FilterOptiontype FilterSchematype FilterValuestype NumberFieldtype NumberFiltertype NumberOptype OptionsFieldtype RemoteOptionFieldtype SearchMappingtype TextFieldtype TextMatchOptype JsonFilterLeaftype JsonFilterNodetype JsonScalartype QueryParamsOptionstype QueryParamStyletype SerializeOptionstype PageUrlStatetype UrlCodectype UrlCodecOptions

Accessibility

  • Every field's label is required: it names the chip, the panel field and what agents set.

Agent actions

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.