Skip to main content
Signature

About this widget

Displays the highlighted attributes of your search results. It isn’t a widget but a component available from the hits or infiniteHits widgets templates.

Examples

JavaScript

Options

attribute
string
required
The highlighted attribute.Specify a dot-separated value for nested objects, like actor.name
JavaScript
hit
object
required
The original hit object provided to the function. It contains all the data for that result, including the highlighted parts.
The hit object must contain a _highlightResult[attribute].value property.
JavaScript
highlightedTagName
string
default:"mark"
The HTML element that wraps the highlight.
JavaScript
nonHighlightedTagName
string
default:"span"
The HTML element that wraps the non-highlighted parts of the string.
JavaScript
separator
string
default:", "
The character between each item when the attribute to highlight is an array.
JavaScript
cssClasses
object
default:"{}"
The CSS classes you can override:
  • root. The component’s root element.
  • highlighted. The highlighted parts.
  • nonHighlighted. The non-highlighted parts.
  • separator. The separator elements between highlighted parts.
JavaScript

HTML output

HTML
Last modified on July 10, 2026