This is documentation for the next version of Grafana. For the latest stable release, go to the latest version.

API Reference@grafana/datafindHighlightChunksInText

findHighlightChunksInText() function

findHighlightChunksInText() function

Adapt findMatchesInText for react-highlight-words findChunks handler. See https://github.com/bvaughn/react-highlight-words#props

Signature

export declare function findHighlightChunksInText({ searchWords, textToHighlight, }: {
    searchWords: Array<string | RegExp>;
    textToHighlight: string;
}): TextMatch[];

Import

import { findHighlightChunksInText } from '@grafana/data';

Parameters

Parameter Type Description
{ searchWords, textToHighlight, } {
searchWords: Array<string | RegExp>;
textToHighlight: string;
}

Returns:

TextMatch[]