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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-advanced-filter

v1.0.1

Published

A customizable advanced filter component for React.

Readme

Advanced Filter Component

🔥 Demo

Check out the live demo: View Demo

A reusable and customizable Advanced Filter Component for React, built with PrimeReact and styled with external CSS.


✨ Features

  • Easy-to-use dropdown for filter match modes.
  • Customizable styles.
  • Works out of the box with PrimeReact icons and theming.

📦 Installation

First, install the package:

npm install react-advanced-filter

You also need to install peer dependencies if you haven't already:

npm install primereact primeicons react react-dom

🚀 Usage

  1. Import the component and CSS:
import FilterComponent, { ClearFilter } from "react-advanced-filter";
import 'react-advanced-filter/react-advanced-filter.css';
  1. Use it in your application:
import React, { useState } from 'react';
import FilterComponent, { ClearFilter } from "react-advanced-filter";
import 'react-advanced-filter/react-advanced-filter.css';

function App() {
    const myData = [
        { name: 'John Wick', city: 'New York' },
        { name: 'Alice Lamb', city: 'Los Angeles' },
        { name: 'Bob Walker', city: 'Chicago' },
    ];

    const filterRef = useRef(null);
    const [filtered, setFiltered] = useState(myData);

    return (
        <>
            <FilterComponent
                ref={filterRef}
                data={myData}
                keyField="name" // can also be city (Only considered when dataset is array of object)
                onFilter={(filteredData) => setFiltered(filteredData)}
            />
            <ClearFilter
                ref={filterRef}
            />
        </>
    );
}

export default App;

📋 Props

<FilterComponent />

| Prop | Type | Required | Description | |:-----------|:-----------------------------|:---------|:------------| | ref | React.RefObject | Yes | Ref object used to control the component externally (required for clearing filters). | | data | any[] | Yes | The dataset you want to filter. It can be an array of strings or array of objects. | | keyField | string | No | The object field to use for filtering (only needed if data is an array of objects). | | onFilter | (filteredData: any[]) => void| Yes | Callback function that returns the filtered data after applying the filter. |


<ClearFilter />

| Prop | Type | Required | Description | |:-------|:-------------------|:---------|:------------| | ref | React.RefObject | Yes | Ref object linked to the FilterComponent to clear/reset the filter externally. |


🎨 Styling

This component expects you to import its CSS manually:

import 'react-advanced-filter/react-advanced-filter.css';

🔗 Peer Dependencies

Make sure you have the following packages installed in your project:

  1. react
  2. react-dom
  3. primereact
  4. primeicons