0.2.1 • Published 7 years ago

react-highlighted v0.2.1

Weekly downloads
13
License
MIT
Repository
github
Last release
7 years ago

react-higlighted

highlight matching text with react components

usage

import { highlight } from "react-higlighted";

const span = (text: string) => <span>{text}</span>;
const em = (text: string) => <em>{text}</em>;

function SearchResult(props: { text: string, query: string }) {
  return (
    <div className="result">
      {highlight(props.text, props.query, span, em)}
    </div>
  );
}

see more examples in tests

0.2.1

7 years ago

0.2.0

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago