Skip to main content

filters

The global search filter allows users to search across all columns in the table. It provides a quick way to find specific data without needing to filter each column individually. It uses a fuzzy search by default, and highlights any directly matching text in the table.

Query Parameters

Current global search text is pushed to the URL as a query parameter search, so that users can share links to specific pre-searched data in a table. For example, navigating to ?search=cat will open the table with "cat" as the search term. When the search box is empty, the search query parameter is removed from the URL to keep it clean.

Custom Query Parameter Name

You can customize the query parameter name used for global search by setting tableOptions.queryKeys.search.

Generally we recommend keeping the default search value to ensure consistency across your application and user familiarity, however if you are using multiple tables on the same page you need to customize the query parameter names to avoid conflicts.

<DataTable tableOptions={{ queryKeys: { search: 'my-custom-table-search' } }} />

Disable Query Parameters

You can also disable query parameters for global search by setting tableOptions.queryKeys.search to false.

<DataTable tableOptions={{ queryKeys: { search: false } }} />

Column Filters

Column filters allow users to filter data in the table based on specific column values. Each column can have its own filter, enabling users to narrow down the data displayed according to their needs.

Filters are hidden by default, but can be shown by clicking the filter icon in the column header. On load, if any column has a filter defined in the query parameters the filter row will be shown automatically.

Text Filters

The default filter type is a text input that performs a fuzzy search, similar to the global search, only just for that specific column.

Unless filtering is disabled for a specific column, all columns will have text filters by default.

Select Filters

Often it is more useful to have a select dropdown as a filter, especially when the column has a limited set of known values. You can set the filterVariant property in the column definition to 'select' to enable a select filter for that column.

const columns: Columns<Cat> = [
  {
    accessorKey: 'age',
    filterVariant: 'select',
    header: 'Age',
  },
]

The select options will be generated automatically based on the unique values present in that column's dataset.

You can provide your set of options by using the filterSelectOptions property in the column definition.

const columns: Columns<Cat> = [
  {
    accessorKey: 'age',
    filterSelectOptions: [
      { label: '1', value: '1' },
      { label: '10', value: '10' },
    ],
    filterVariant: 'select',
    header: 'Age',
  },
]
Empty Values

Any value considered "empty" (e.g. null, undefined, empty string, empty array) will be represented as None in the select options to allow for filtering on missing data.


Invalid Values

When navigating to a URL with an invalid filter value (i.e. a value not present in the select options), the filter will be a applied regardless.

This allows for sharing links with pre-applied filters even if the filter value is not present in the current dataset, since the underlying data can change. We don't want to silently ignore the filter, as that would cause a confusing experience when navigating to a filtered link only to find no filter applied.

Multi-Select Filters

You can also set the filterVariant property in the column definition to 'multi-select' to enable a multi-select filter for that column. This is arguably the most useful filter type, as it allows users to select multiple values to filter on. Otherwise, it works the same way as the select filter.

const columns: Columns<Cat> = [
  {
    accessorKey: 'breed',
    filterVariant: 'multi-select',
    header: 'Breed',
  },
]

Locked Column Filters

You can pre-filter and lock a column filter by setting the lockedFilter property in the column definition, this works for both text, select and multi-select filters.

const columns: Columns<Cat> = [
  {
    accessorKey: 'name',
    lockedFilter: 'M',
    header: 'Name',
  },
  {
    accessorKey: 'breed',
    filterVariant: 'multi-select',
    header: 'Breed',
    lockedFilter: ['Abyssinian', 'American Bobtail'],
  },
  {
    accessorKey: 'microchip',
    filterVariant: 'select',
    header: 'Microchip',
    lockedFilter: 'true',
  },
]
Name
Breed
Age
Birthdate
Last Checkup
Nationality
Microchip
Title
Identifier
Display Name
IP Address
Skills
Filter
Filter
Filter
Filter
Selkirk Rex
17
2008-02-08T18:48:47.009Z
2025-03-30T17:08:37.394Z
πŸ‡²πŸ‡΅
Legacy Implementation Liaison
0
Aric35
177.221.104.53
Hunting
American Shorthair
3
2022-01-11T19:38:47.327Z
2025-09-20T18:22:06.143Z
πŸ‡΅πŸ‡²
Principal Applications Developer
1
Jocelyn_Koelpin
183.178.38.10
Playing
Havana
17
2007-12-02T16:09:32.758Z
2025-03-27T23:53:33.990Z
πŸ‡³πŸ‡«
Investor Applications Administrator
2
Kathleen.Mosciski57
186.101.171.88
Hunting
Japanese Bobtail
–
2007-05-16T14:16:12.809Z
2025-07-02T10:03:51.929Z
πŸ‡¬πŸ‡³
Internal Infrastructure Planner
3
Crystal49
a36a:a9ed:0bdc:1feb:1854:e72d:11a4:43cb
Purring
American Wirehair
20
2005-03-20T05:26:51.899Z
2025-11-01T17:56:07.953Z
πŸ‡°πŸ‡­
Customer Optimization Administrator
4
Beverly59
4b1b:da8f:8528:04a2:c454:39e4:da0f:b2bb
Climbing
Himalayan
–
2024-11-23T15:17:50.905Z
2025-02-26T09:06:36.021Z
πŸ‡»πŸ‡¬
Forward Identity Assistant
5
May.Prosacco86
c73b:f2e2:f8db:0cef:aaa6:4d3c:8dcd:17e1
Sleeping
American Bobtail
12
2013-05-10T22:59:10.107Z
2025-03-20T13:16:31.031Z
πŸ΄β€β˜ οΈ
Legacy Group Manager
6
Audie.Hackett
193.225.156.126
Meowing
Exotic Shorthair
11
2014-02-03T02:29:26.148Z
2025-05-07T01:49:29.124Z
πŸ‡±πŸ‡Ή
International Mobility Architect
7
Christy.Bode-Lueilwitz11
203.128.8.19
Meowing
Peterbald
20
–
2025-01-08T03:41:04.126Z
πŸ‡ΊπŸ‡³
Chief Intranet Technician
8
Janae7
11.134.30.108
Jumping
American Shorthair
14
2011-05-14T02:26:51.612Z
2025-08-22T01:07:28.240Z
πŸ‡«πŸ‡·
Legacy Quality Analyst
9
Darrel.Simonis26
ae80:6f80:acc6:4188:fa52:edef:eefe:19f2
Scratching
Showing 1-10 of 1000
1 of 100......
10 Rows
Showing 1-10 of 1000
1 of 100......
10 Rows

Disable Column Filters

You can disable a column filter by setting enableColumnFilter to false in the column definition.

const columns: Columns<Cat> = [
  {
    accessorKey: 'name',
    enableColumnFilter: false, // Disable filter for this column
    header: 'Name',
  },
  {
    accessorKey: 'age',
    header: 'Age',
    enableColumnFilter: false, // Disable filter for this column
  },
]

In the example below the three first columns have no filtering possibilities, note that the global search will still match on values in all columns, even those without column filters.

Name
Breed
Age
Birthdate
Last Checkup
Nationality
Microchip
Title
Identifier
Display Name
IP Address
Skills
Filter
Filter
Selkirk Rex
17
2008-02-08T18:48:47.009Z
2025-03-30T17:08:37.394Z
πŸ‡²πŸ‡΅
Legacy Implementation Liaison
0
Aric35
177.221.104.53
Hunting
American Shorthair
3
2022-01-11T19:38:47.327Z
2025-09-20T18:22:06.143Z
πŸ‡΅πŸ‡²
Principal Applications Developer
1
Jocelyn_Koelpin
183.178.38.10
Playing
Havana
17
2007-12-02T16:09:32.758Z
2025-03-27T23:53:33.990Z
πŸ‡³πŸ‡«
Investor Applications Administrator
2
Kathleen.Mosciski57
186.101.171.88
Hunting
Japanese Bobtail
–
2007-05-16T14:16:12.809Z
2025-07-02T10:03:51.929Z
πŸ‡¬πŸ‡³
Internal Infrastructure Planner
3
Crystal49
a36a:a9ed:0bdc:1feb:1854:e72d:11a4:43cb
Purring
American Wirehair
20
2005-03-20T05:26:51.899Z
2025-11-01T17:56:07.953Z
πŸ‡°πŸ‡­
Customer Optimization Administrator
4
Beverly59
4b1b:da8f:8528:04a2:c454:39e4:da0f:b2bb
Climbing
Himalayan
–
2024-11-23T15:17:50.905Z
2025-02-26T09:06:36.021Z
πŸ‡»πŸ‡¬
Forward Identity Assistant
5
May.Prosacco86
c73b:f2e2:f8db:0cef:aaa6:4d3c:8dcd:17e1
Sleeping
American Bobtail
12
2013-05-10T22:59:10.107Z
2025-03-20T13:16:31.031Z
πŸ΄β€β˜ οΈ
Legacy Group Manager
6
Audie.Hackett
193.225.156.126
Meowing
Exotic Shorthair
11
2014-02-03T02:29:26.148Z
2025-05-07T01:49:29.124Z
πŸ‡±πŸ‡Ή
International Mobility Architect
7
Christy.Bode-Lueilwitz11
203.128.8.19
Meowing
Peterbald
20
–
2025-01-08T03:41:04.126Z
πŸ‡ΊπŸ‡³
Chief Intranet Technician
8
Janae7
11.134.30.108
Jumping
American Shorthair
14
2011-05-14T02:26:51.612Z
2025-08-22T01:07:28.240Z
πŸ‡«πŸ‡·
Legacy Quality Analyst
9
Darrel.Simonis26
ae80:6f80:acc6:4188:fa52:edef:eefe:19f2
Scratching
Showing 1-10 of 1000
1 of 100......
10 Rows
Showing 1-10 of 1000
1 of 100......
10 Rows

Query Params

Current column filter values are pushed to the URL as query parameters, so that users can share deep-links to specifically filtered data in a table.

Custom Query Parameter Name

You can customize the query parameter name used for a filter by setting the column id in the column definition.

const columns: Columns<Cat> = [
  {
    accessorKey: 'name',
    id: 'customNameFilter',
    header: 'Name',
  },
]

Unless explicitly set in the column definition, column ids will be the header value formatted as camelCase.

Generally we recommend keeping the default value to ensure consistency across your application and user familiarity, however if you are using multiple tables on the same page and they have columns with the same header names, you may need to customize the ids to avoid conflicts.

Disable Query Parameters

Future Feature

We plan to add the ability to disable query parameters for column filters in the near future. (#1311)