Query-based substring highlighting using Mark.
Import
import { Highlight } from '@oztix/roadie-components'
Examples
Default
<p>
<Highlight
text='The quick brown fox jumps over the lazy dog'
query='quick'
/>
</p>
Intents
The default intent is info.
<p>
<Highlight text='Neutral intent highlight' query='Neutral' intent='neutral' />
</p>
<p>
<Highlight text='Accent intent highlight' query='Accent' intent='accent' />
</p>
With multiple queries
<p>
<Highlight
text='React, Vue, and Svelte are popular JavaScript frameworks'
query={['React', 'Vue', 'Svelte']}
/>
</p>
With case sensitivity
By default, matching is case-insensitive.
{}
<p>
<Highlight text='Hello World' query='hello' />
</p>
{}
<p>
With match first only
By default, all occurrences are highlighted.
{}
<p>
<Highlight text='foo bar foo baz foo' query='foo' matchAll={true} />
</p>
{}
<p>
API reference
querystring | string[]
Requiredintent"neutral" | "neutral-inverted" | "brand" | "brand-secondary" | "brand-blue" | "brand-orange" | "brand-purple" | "accent" | "danger" | "success" | "warning" | "info" | null
as"mark"
DeprecatedDeprecated: Use `render` instead. `as` will be removed in v3.0.0.
renderRoadieRenderProp
Escape hatch — swap the underlying element with full control over the rendered shape (e.g. `render={<h2 />}` to highlight a heading).