react-highlight-regex
v0.1.1
Published
Highlight texts with regex!
Downloads
84
Readme
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 |
