Description
react-highlight-words is a React component that highlights words within a larger body of text. You pass it an array of search terms and the text to search, and it marks every occurrence of those terms, wrapping each match so you can style it. The README's basic example highlights and, or and the in a sentence about a dog and a cat, with a highlight class name applied to each match. The documentation covers an active match, which lets you mark one occurrence differently from the rest, class names set per search term, and custom tags in place of the default wrapper. It also supports custom matching logic for cases where a simple string comparison is not enough, and an option for ignoring accents, so that a search for a plain word also matches its accented forms. A playground lets you try the props interactively, and a props reference lists the full set of options. Installation is through npm, and the TypeScript definitions are included in the published package. The project is maintained on GitHub under the bvaughn account, and the README links a GitHub sponsors page and a coffee donation option for supporting the work. It is useful for search results, document viewers and any interface where matching words should stand out in text.…
Highlights
- Highlights search terms within text
- Active match and per-term class names
- Custom tags and custom matching
- Ignores accents when matching
- TypeScript definitions included
Ratings & Reviews
No ratings yet
Be the first to rate react-highlight-words.
People also visit

rich-textarea
A small customizable textarea for React to colorize, highlight, decorate texts
react-highlight-words FAQ
What does react-highlight-words do?
It highlights each occurrence of the search terms you give it inside a body of text.
How do I install it?
Run npm install react-highlight-words. TypeScript definitions are included in the published package.
Can I highlight one match differently?
Yes. The active match option lets you style a single occurrence.
Can it ignore accents?
Yes. There is an option for ignoring accents, so a plain search also matches accented forms.
Is there a demo?
Yes. The docs include a playground where you can try the props.
What are the best react-highlight-words alternatives?
Popular alternatives to react-highlight-words include react-highlighter, react-highlight and vue-word-highlighter. See all react-highlight-words alternatives



















