Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/metonym/react-fuzzy-highlighter

Lightweight fuzzy search highlighting component using fuse.js
https://github.com/metonym/react-fuzzy-highlighter

fusejs fuzzy highlight highlight-words react text-highlighter

Last synced: 23 days ago
JSON representation

Lightweight fuzzy search highlighting component using fuse.js

Awesome Lists containing this project

README

        

# react-fuzzy-highlighter

> Lightweight fuzzy search highlighting component using [`fuse.js`](https://github.com/krisk/Fuse).

This component wraps `fuse.js` and provides matched and unmatched text in an iterable format.

## [Demo](https://metonym.github.io/react-fuzzy-highlighter/) · [Changelog](CHANGELOG.md)

## Install

```bash
# Yarn
yarn add react-fuzzy-highlighter

# npm
npm i react-fuzzy-highlighter

# pnpm
pnpm i react-fuzzy-highlighter
```

## Usage

```jsx
import * as React from "react";
import FuzzyHighlighter, { Highlighter } from "react-fuzzy-highlighter";

export default class extends React.Component {
render() {
return (

{({ results, formattedResults, timing }) => {
return (


    {formattedResults.map((formattedResult, resultIndex) => {
    if (formattedResult.formatted.title === undefined) {
    return null;
    }

    return (




  • );
    })}

);
}}

);
}
}
```

## Example

The [examples](examples) folder contains the source code used for the [demo](https://metonym.github.io/react-fuzzy-highlighter).

## License

[MIT](LICENSE)