Documentation

Field Definitions

A FilterFieldDefinition describes a single filterable column.

Type

ts
type FilterFieldDefinition = {
  name: string;
  label: string;
  type: "string" | "number" | "boolean" | "date" | "select";
  options?: { label: string; value: string }[];
  operators?: OperatorType[];
};

Properties

PropertyTypeDescription
namestringThe key sent to the server (e.g. price, status).
labelstringThe human-readable label shown in the filter dropdown.
typeFieldTypeDetermines the input UI rendered (text, number input, date picker, etc.).
optionsOption[]Required when type is "select". Populates the value dropdown.
operatorsOperatorType[]Restricts which operators (e.g. eq, gt, contains) are available for this field. If omitted, all operators valid for the type are shown.

Field Types

TypeInput shownDefault operators
stringText inputis, is not, contains, does not contain, starts with, ends with, is empty, is not empty
numberNumber input=, , >, , <, , is empty, is not empty
booleanToggle / selectis true, is false
dateDate pickeris, is before, is after, is between, is empty, is not empty
selectDropdownis, is not, is empty, is not empty

Example

tsx
const fields: FilterFieldDefinition[] = [
  // Simple string field
  { name: "name", label: "Name", type: "string" },

  // Number field with restricted operators
  {
    name: "price",
    label: "Price",
    type: "number",
    operators: ["gt", "lt", "eq"],
  },

  // Select field with custom options
  {
    name: "status",
    label: "Status",
    type: "select",
    options: [
      { label: "Active",   value: "active"   },
      { label: "Inactive", value: "inactive" },
      { label: "Pending",  value: "pending"  },
    ],
  },

  // Date field
  { name: "created_at", label: "Created At", type: "date" },
];