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

react-complex-filter

v0.1.2

Published

![Simple Filter](images/filter.png)

Downloads

16

Readme

React Filter (BETA)

Simple Filter

Simple filter library to provide an efficient filter for lists as it is also used by

  • Google Cloud
  • Contentful
  • ... any many more

Features

  • Autocompletion to add new filters.
  • Easy to use with the keyboard.
  • Based on custom filter model that defines which fields and operators are allowed.
  • Support for custom value editors.

Usage

Step 0: Install React-filter

npm i react-complex-filter

Step 1: Define your model

The model defines which fields are supported and which operators can be used with these fields. It is recommended to create the model in the backend and query it together with your list.

const Operators = [
    'eq',
    'ne',
    'lt'
];

const model = {
    operators: {
        eq: {
            label: 'equal'
        },
        ne: {
            label: 'not equal' // Optional label for the operator
        },
        empty: {
            isEmpty: true // No value is shown.
        }
    },
    fields: {
        string: {
            label: 'String',
            operators: Operators,
            component: StringValue
        },
        number: {
            label: 'Number',
            operators: Operators,
            component: StringValue
        },
        dateTime1: {
            label: 'DateTime',
            operators: Operators,
            component: DateValue
        },
        boolean1: {
            label: 'Boolean',
            operators: Operators,
            component: BooleanValue
        },
        enum: {
            label: 'Enum',
            operators: Operators,
            component: EnumValue,
            args: [{
                value: 'Option1',
                label: 'Option1'
            }, {
                value: 'Option2',
                label: 'Option2'
            }, {
                value: 'Option3',
                label: 'Option3'
            }, {
                value: 'OptionG_1',
                label: 'OptionG_1',
                group: 'G'
            }, {
                value: 'OptionG_2',
                label: 'OptionG_2',
                group: 'G'
            }]
        }
    }
};

Step 2: Construct your query

The query is always a combination of a free search query and a logical filter.

const query = {
    query: 'My Query',
    logical: {
        logic: 'and',
        filters: [{
            field: 'string1',
            operator: 'eq'
        }, {
            field: 'number1',
            operator: 'eq'
        }, {
            field: 'enum',
            operator: 'eq'
        }]
    }
};

Step 3: Use the component

const [query, setQuery] = React.useState(query);

<div id='portals'>
    <ComplexFilter filter={query} onChange={setQuery} model={model} />
</div>

The portals div is used to render dropdowns in front of your other components, independent from the positioning. Is is therefore recommend to add the div to your index.html file, after your actual app. For example

<div id="app"></div>
<div id="portals"></div>