With the Highlight component, you can spotlight words.
Usage
import { Highlight } from "@chakra-ui/react"<Highlight query="Hello">Hello World</Highlight>Examples
Multiple
Pass an array of strings to the query prop to highlight multiple substrings.
With the Highlight component, you can spotlight, emphasize and accentuate words.
Custom Style
Use the styles prop to customize the style of the highlighted text.
With the Highlight component, you can spotlight words.
Search Query
Use the highlight component to highlight search query results.
Search result for: spot
Spotlight bulb
Spot cleaner
Spot ceiling
With Squiggle
Here's an example of how to render a custom squiggle image around the highlighted text. Useful for a more fancy effect.
Endless scale, powered by real humans.
Props
| Prop | Default | Type |
|---|---|---|
query * | string | string[]The query to highlight in the text | |
text * | stringThe text to highlight | |
styles | SystemStyleObject | undefined | |
ignoreCase | booleanWhether to ignore case while matching | |
matchAll | booleanWhether to match multiple instances of the query | |
as | React.ElementTypeThe underlying element to render. | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |