Highlight select fragments of a string using an HTML element and/or a class.
npm install react-highlighter --save
var Highlight = require('react-highlighter');
<Highlight search="brown">The quick brown fox jumps over the lazy dog</Highlight>
search
: The string of text (or Regular Expression) to highlightcaseSensitive
: Determine whether string matching should be case-sensitive. Not applicable to regular expression searches. Defaults tofalse
matchElement
: HTML tag name to wrap around highlighted text. Defaults tostrong
matchClass
: HTML class to wrap around highlighted text. Defaults tohighlight
Using Mocha/Chai/React.addons.TestUtils for testing.
npm test