# react-filter-control

> [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/komarovalexander/react-filter-control/blob/master/LICENSE) [![Build Status](https://travis-ci.com/komarovalexander/react-filter-control.svg?branch=master)](https://t

Latest version **2.2.0** (published 2026-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-filter-control
pnpm add react-filter-control
yarn add react-filter-control
bun add react-filter-control
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2026-10-20 |
| First published | 2018-08-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 69.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 54 |
| Author | Alexander Komarov |
| Maintainers | sanr |

## Links

- npm: https://www.npmjs.com/package/react-filter-control
- Repository: https://github.com/komarovalexander/react-filter-control
- Homepage: https://github.com/komarovalexander/react-filter-control#readme
- Issues: https://github.com/komarovalexander/react-filter-control/issues
- npm.io page: https://npm.io/package/react-filter-control

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.6.2

## Recent versions

- 2.2.0 (latest) — 2026-10-20
- 2.1.1 — 2025-05-21
- 2.1.0 — 2019-10-23
- 1.0.0 — 2019-01-12
- 0.1.19 — 2019-01-12
- 0.1.18 — 2019-01-12
- 0.1.17 — 2019-01-12
- 0.1.15 — 2019-01-12
- 0.1.14 — 2018-11-10
- 0.1.13 — 2018-11-10
- 0.1.12 — 2018-11-10
- 0.1.11 — 2018-11-10
- 0.1.10 — 2018-11-10
- 0.1.9 — 2018-11-09
- 0.1.8 — 2018-11-05
- … 8 more at https://npm.io/package/react-filter-control/versions

## README

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/komarovalexander/react-filter-control/blob/master/LICENSE) [![Build Status](https://travis-ci.com/komarovalexander/react-filter-control.svg?branch=master)](https://travis-ci.com/komarovalexander/react-filter-control)
[![Coverage Status](https://coveralls.io/repos/github/komarovalexander/react-filter-control/badge.svg?branch=master)](https://coveralls.io/github/komarovalexander/react-filter-control?branch=master)
# React Filter Control
The React component for building the composite filter criteria

[Demo (JS)](https://codesandbox.io/s/4xk994jovw)    |    [Demo (TS)](https://codesandbox.io/s/react-typescript-uhtxt)   

[Together With Data Table](https://komarovalexander.github.io/ka-table/#/filter-extended)

## Overview
![Filter Control](https://github.com/komarovalexander/react-filter-control/raw/master/static/filter-control.png)

## Installation
npm
```sh
npm install react-filter-control
```
yarn
```sh
yarn add react-filter-control
```
`react` 16.3 or newer is a peer dependency: the component uses the React of the application.

## Usage
### A basic example

```js
import React from "react";
import { createRoot } from "react-dom/client";
import FilterControl from "react-filter-control";
import { fields, filterValue } from "./data.js";

const handleFilterValueChange = filterValue => {
  // ...
};

const App = () => {
  return (
    <FilterControl
      filterValue={filterValue}
      fields={fields}
      onFilterValueChanged={handleFilterValueChange}
    />
  );
};

createRoot(document.querySelector("#root")).render(<App />);
```

[Open Example in CodeSandbox](https://codesandbox.io/s/mqnmlypmkp)

## API

<a name="FilterControl"></a>
### FilterControl
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| fields | [<code>Array.&lt;Field&gt;</code>](#Field) | The fields settings |
| filterValue | [<code>FilterValue</code>](#FilterValue) | The filterValue settings |
| groups | [<code>Array.&lt;Group&gt;</code>](#Group) | The groups settings |
| onFilterValueChanged | <code>event</code> | The filter value changed handler |

<a name="FilterValue"></a>

### FilterValue : <code>Object</code>
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| groupName | <code>string</code> | Group name |
| items | <code>Array.&lt;(FilterValueGroup\|FilterValueItem)&gt;</code> | Items in group |

<a name="FilterValueGroup"></a>

### FilterValueGroup : <code>Object</code>
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| key | <code>key</code> | Item key |
| groupName | <code>string</code> | Group name |
| items | <code>Array.&lt;(FilterValueGroup\|FilterValueItem)&gt;</code> | Items in group |

<a name="FilterValueItem"></a>

### FilterValueItem : <code>Object</code>
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| key | <code>key</code> | Item key |
| field | <code>string</code> | Field |
| operator | <code>string</code> | Operator |
| value | <code>any</code> | Value |

<a name="Field"></a>

### Field : <code>Object</code>
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | Field name |
| caption | <code>string</code> | Field caption |
| operators | [<code>Array.&lt;Operator&gt;</code>](#Operator) | Field operators |

<a name="Group"></a>

### Group : <code>Object</code>
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | Group name |
| caption | <code>string</code> | Group caption |

<a name="Operator"></a>

### Operator : <code>Object</code>
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | Operator name |
| caption | <code>string</code> | Operator caption |

## License
This project is licensed under the terms of the [MIT license](/LICENSE).

---
_Source: https://npm.io/package/react-filter-control · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
