0.1.1 • Published 6 years ago
react-highlight-regex v0.1.1
React highlight regex
Highlight texts with regex!
This packages needs
String.prototype.matchAllto work properly. Check out availability on caniuse before use.
Example and Usage
$ yarn add react-highlight-regeximport * as React from 'react';
import { Highlight } from 'react-highlight-regex';
function BasicUsage() {
return (
<Highlight match={/a|t/} text="An apple a day keeps the doctor away." />
);
}Props
| name | type | description |
|---|---|---|
| text | string | The text to be highlighted. |
| match | RegExp | Regular expression for content to be highlighted |
| highlightClassname | string(optional) | Classname for highlighted parts |