HighlightedText

A component to render text with its parts matching a regex being highlighted.

If `shouldScroll` ir `true` it should scroll to the first occurrence of the highlighted text.

Choose an example

Usage

<script>
  import {HighlightedText} from '@svizzle/ui';
</script>

<HighlightedText
  regex={/wor/gui}
  string='Hello world!'
/>

Props

regex

    /wor/giu
    • lastIndex: 0
    • dotAll: false
    • flags: "giu"
    • global: true
    • hasIndices: false
    • ignoreCase: true
    • multiline: false
    • source: "wor"
    • sticky: false
    • unicode: true

string

    "Hello world! Don't worry!"
Hello world! Don't worry!