Skip to main content

Function: highlightSubstring()

highlightSubstring(text, substring, highlightProps): Element

Renders a text span with all occurrences of the specified sub-string highlighted.

Parameters

ParameterTypeDefault valueDescription

text

string

undefined

source text to display

substring

undefined | string

undefined

sub-string to highlight each instance of inside the text

highlightProps

HTMLProps<HTMLSpanElement>

DEFAULT_HIGHLIGHT_PROPS

props to pass to each <span> for a sub-string occurrence

Returns

Element

Defined in

widgets/utility/listElementView.tsx:140