Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

Highlight

Used to highlight substrings of a text.

SourceStorybookRecipeArk
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

PropDefaultType
query *
string | string[]

The query to highlight in the text

text *
string

The text to highlight

ignoreCase
boolean

Whether to ignore case while matching

matchAll
boolean

Whether to match multiple instances of the query

styles
SystemStyleObject

Previous

Heading

Next

Kbd