Highlights occurrences of a given string within another string of text. Wraps
each match with a <mark> tag which provides browser default styling.
import { TextHighlight } from '@wordpress/components';
LinksPermalink to this section
PropsPermalink to this section
| Name | Default | Description |
|---|---|---|
highlight Required | '' |
The string to search for and highlight within the |
text Required | '' |
The string of text to be tested for occurrences of then given
|
ExamplesPermalink to this section
DefaultPermalink to this section
const Default = () => {
return (
<TextHighlight
text="We call the new editor Gutenberg. The entire editing experience has been rebuilt for media rich pages and posts."
highlight="Gutenberg" />
);
};