npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mantine-datatable-filter

v1.0.9

Published

Column filter, sorting and pagination handler for mantine-datatable

Readme

Mantine Datatable Filter

a lightweight hook which help to handle mantine datatable filtering, column sorting and pagination.

Installation

npm install mantine-datatable-filter

Dependencies

  • @mantine/core
  • @mantine/hooks
  • mantine-datatable

Example

  1. Import libraries.
import { DataTable } from 'mantine-datatable'
import useMantineDataTableFilter from 'mantine-datatable-filter'
  1. Create handler hook.
const dtFilter = useMantineDataTableFilter({
    sort: {
        columnAccessor: 'id',
        direction: 'desc',
    },
    pagination: {
        totalRecords: totalRecords ?? 0,
        sizes: [10, 15, 20],
    },
    columns: [
      {
          accessor: 'id',
          type: 'number',
          inputProps: {
              label: 'ID',
              placeholder: 'Search by ID',
          }
      },
      {
          accessor: 'name',
          type: 'text',
          inputProps: {
              label: 'Name',
              placeholder: 'Search by name',
          }
      }
    ],
    onChange: (values, cleanedValues) => {
        // handle change
    },
    debounced: 200
})
  1. Add props to datatable.
return <DataTable
           // Add handler props here.
           {...dtFilter.props}
           columns={[
               {
                 accessor: 'id',
                 title: 'ID',
                 sortable: true,
                 // Add filter props for each of columns.
                 ...dtFilter.getFilterProps('id')
               },
               {
                 accessor: 'name',
                 title: 'Name',
                 sortable: true,
                 ...dtFilter.getFilterProps('name')
               }
           ]}
       />

APIs

HandlerOptions

columns

| Property | Type | Default Value | Description | | --- | --- | --- | --- | | accessor | string | | Primary key for each column. | | type | "text" | "number" | "date" | "datetime" | "select" | | Column type. | | post? | (value: "text" | "number" | "date" | "datetime" | "select") => "text" | "number" | "date" | "datetime" | "select" | () => {} | Post process function for a column. Note this will affect only for cleaned value. | | inputProps? | InputProps | {} | Props for filter input. Please refer to mantine documentations for input props. | | resetLabel? | string | "Reset" | Date type only. |

sorts?

| Property | Type | Default Value | Description | | --- | --- | --- | --- | | columnAccessor | string | | Default sorting key. | | direction | "asc" | "desc" | | Direction of sorting. |

pagination

| Property | Type | Default Value | Description | | --- | --- | --- | --- | | initialPage | number | 1 | Initial page. | | totalRecords | number | | Total records. | | sizes? | number | number[] | 10 | Total records per page. |

onChange(values, cleanedValues) => void

| Property | Type | Default Value | Description | | --- | --- | --- | --- | | values | HandlerValues | | Raw values. | | cleanedValues | HandlerCleanedValues | | Cleaned, with post data process and removed blank filters' values. |

| Property | Type | Default Value | Description | | --- | --- | --- | --- | | debounced? | number | 0 | Debounced state for onChange when user input on filters. | | deps? | DependencyList | any[] | [] | Dependencies for triggering onChange. This is useful for adding extra features to the handler. |

HandlerReturn

| Property | Type | Description | | --- | --- | --- | | values | HandlerValues | Handler values. | | getFilterProps | (accessor: string) => FilterProps | Getter for generating filter option props for a column. | | refetch | () => void | Function for triggering onChange. | | props | DatatableProps | Sorting and pagination props for datatable. |

HandlerValues

| Property | Type | Description | | --- | --- | --- | | sort | DataTableSortStatus | null | Column for sorting. | | filters | all of { key: FilterType } | Column filters values. | | pagination | { page: number; size: number } | Column pagination values. |

FilterType

| Property | Type | Description | | --- | --- | --- | | accessor | string | Primary key for each column. | | type | "text" | "number" | "date" | "datetime" | "select" | Column type. | | value | (depends on type, refer to mantine documentation) | Column value. |