Skip to content

Highlight

The Highlight component allows you to highlight specific words or phrases within a text. It supports multiple search queries, case-insensitive matching, and customizable color schemes.

Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor.
// Import component
import { Highlight } from '@fintech-sandpit/ui/react';
// Import styles (optional)
import '@fintech-sandpit/ui/style/components/highlight.css';
return (
<Highlight
text="Lorem ipsum dolor sit amet"
query="sit amet"
/>
);
NameTypeRequiredDefaultDescription
textstringYes—The text to highlight
querystring | string[]Yes—Text or array of texts to search for
colorSchemeColorScheme—Color scheme for highlighted text
ignoreCasebooleanfalseWhether to ignore case when matching
matchAllbooleanfalseIf true and multiple queries, match all at once
type ColorScheme = 'neutral' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger'