# stimulus-filter

> Stimulus Controller to filter out elements from a list

Latest version **1.0.0** (published 2019-10-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install stimulus-filter
pnpm add stimulus-filter
yarn add stimulus-filter
bun add stimulus-filter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-10-16 |
| First published | 2019-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Olivier |
| Maintainers | olimart |

## Links

- npm: https://www.npmjs.com/package/stimulus-filter
- Repository: https://github.com/olimart/stimulus-filter
- npm.io page: https://npm.io/package/stimulus-filter

## Dependencies (1)

- [stimulus](https://npm.io/package/stimulus.md) ^1.1.1

## Recent versions

- 1.0.0 (latest) — 2019-10-16

## README

# Stimulus filter controller

## Installation

1. Add package `yarn add stimulus-filter`
2. Import package in your application

```js
import { Application } from 'stimulus'
const application = Application.start()

import FilterController from 'stimulus-filter'
application.register('filter', FilterController)
```

## Configuration

```html
<div data-controller="filter"
     data-filter-class-to-toggle="class_to_toggle"> <!-- 'dnone' by default -->
```

## Example

```html
<div data-controller="filter">
  <input data-target="filter.source"
         data-action="input->filter#filter"
         type="text"
         placeholder="Search..." />

  <div data-target="filter.filterable" data-filter-key="article 1 to.downcase">
    <h2>Article 1</h2>
    ...
  </div>

  <div data-target="filter.filterable" data-filter-key="article 2 to.downcase">
    <h2>Article 2</h2>
    ...
  </div>
</div>

  <p data-target="filter.count"></p> <!-- Optional. Not working properly -->
</div>
```

## Publish new version

1. Run `yarn build`
2. Update `CHANGELOG.md`
3. Run `yarn publish`

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