React text highlight component
Live Demo
Installation
npm install react-hi-text --save
Examples
React highlight text bundle with UMD
mode, if you don't use any module loader It will exports ReactHiText
as global variable.
with script tag
With Module:
var React = var HiText = var App = React React
output:
Hello highlight text
Props
hi
Set highlight with a word.
case-sensitive
Match word with case sensitive. default is false
.
className
set class name. default is highlight
.
Method
clean()
Clear all highlights.
hasMatched
Check whether or not match any words.
Known issue
Cross tag highlight issue:
e.g.
JavaScript
expect output:
JavaScript