Skip to content

brianmcallister/react-highlight-text

Repository files navigation

@brianmcallister/react-highlight-text

codecov .github/workflows/cicd.yml npm version

React binding for @brianmcallister/highlight-text

react-highlight-text is a React component that integrates with highlight-text.

Table of contents

Demo

Hosted demo: https://react-highlight-text.netlify.com/

You can also run the demo locally. To get started:

git clone [email protected]:brianmcallister/react-highlight-text.git
cd react-highlight-text/demo
npm i
npm start

Installation

npm install @brianmcallister/react-highlight-text

Usage

import HighlightText from '@brianmcallister/react-highlight-text';

const MyComponent = () => (
  <HighlightText
    text="Hello world! I'm highlighted!"
    words={['world', 'highlighted']}
  />
);

API

HighlightText

This is the default export. Use this React component to highlight words in text.

interface Props {
  text: string;
  words: string[];
}