Signature
About this widget
Displays the highlighted attributes of your search results. It isn’t a widget but a component available from thehits
or infiniteHits widgets templates.
Examples
JavaScript
Options
string
required
The highlighted attribute.Specify a dot-separated value for nested objects, like
actor.nameJavaScript
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
string
default:"mark"
The HTML element that wraps the highlight.
JavaScript
string
default:"span"
The HTML element that wraps the non-highlighted parts of the string.
JavaScript
string
default:", "
The character between each item when the attribute to highlight is an array.
JavaScript
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