File size: 1,074 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
title: Highlight
description: Used to highlight substrings of a text.
links:
  source: components/highlight
  storybook: typography-highlight--basic
  recipe: highlight
  ark: https://ark-ui.com/react/docs/utilities/highlight
---

<ExampleTabs name="highlight-basic" />

## Usage

```jsx
import { Highlight } from "@chakra-ui/react"
```

```jsx
<Highlight query="Hello">Hello World</Highlight>
```

## Examples

### Multiple

Pass an array of strings to the `query` prop to highlight multiple substrings.

<ExampleTabs name="highlight-multiple" />

### Custom Style

Use the `styles` prop to customize the style of the highlighted text.

<ExampleTabs name="highlight-with-custom-style" />

### Search Query

Use the highlight component to highlight search query results.

<ExampleTabs name="highlight-search-query" />

### With Squiggle

Here's an example of how to render a custom squiggle image around the
highlighted text. Useful for a more fancy effect.

<ExampleTabs name="highlight-with-squiggle" />

## Props

<PropTable component="Highlight" part="Highlight" />