{"library":"react-highlight-words","title":"React Highlight Words","description":"react-highlight-words is a React component designed to highlight specific words or phrases within a larger body of text. It is currently stable at version v0.21.0, which includes support for React 19. The package primarily sees updates for compatibility with newer React versions and minor feature additions, indicating a consistent but not overly frequent release cadence. Key differentiators include its straightforward API, support for regular expression `searchWords`, automatic escaping of special characters via `autoEscape`, and the ability to apply specific styling or classes to an 'active' match using `activeIndex` and `activeClassName`, making it suitable for search result navigation or interactive text features. It provides a robust solution for visually emphasizing text segments based on user-defined criteria.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install react-highlight-words"],"cli":null},"imports":["import Highlighter from 'react-highlight-words';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport Highlighter from 'react-highlight-words';\n\nconst root = createRoot(document.getElementById('root'));\nroot.render(\n  <Highlighter\n    highlightClassName=\"YourHighlightClass\"\n    searchWords={['dog', 'cat', 'playing']}\n    autoEscape={true}\n    textToHighlight=\"The dog is chasing the cat. Or perhaps they're just playing?\"\n  />\n);","lang":"typescript","description":"Demonstrates basic usage of the Highlighter component, highlighting multiple search words within a given text and applying a custom class to matches.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}