Highlighting matches helps users quickly understand why a result is relevant and speeds up navigation through lists. Depending on the context, one of two styles is used.

Koobiq provides two pipes for highlighting text matches โ€” kbqHighlightBackground and kbqHighlightBold. Both take a string and a search argument, wrapping the found matches in a <mark> tag โ€” kbq-highlight-background for the background-color style and kbq-highlight for the bold style.

Used in selects and other dropdown pickers with filtering, and to highlight matches in complex content: descriptions, messages, and articles. The solid background remains legible in hover and active states within overlays and makes matches noticeable even in long texts.

Matches in text:

Cube
The cube can be represented in many ways. One example is by drawing a graph, a structure in graph theory consisting of a set of vertices that are connected with an edge. This graph also represents the family of a cuboid, a polyhedron with six quadrilateral faces, which includes the cube as its special case. The cube and its graph are a three dimensional hypercube, a family of polytopes that also includes the two-dimensional square and four-dimensional tesseract.

Matches in search results with a complex layout:

Cube
https://en.wikipedia.org/wiki/Cube

A cube is a three-dimensional solid object in geometry. A cube has eight vertices and twelve straight edges of the same length, so that these edges form six faces.

Cube (1997 film)
https://en.wikipedia.org/wiki/Cube_(1997_film)

Cube is a 1997 Canadian science fiction horror film directed and co-written by Vincenzo Natali. A product of the Canadian Film Centre's First Feature Project.

Cube (algebra)
https://en.wikipedia.org/wiki/Cube_(algebra)

In arithmetic and algebra, the cube of a number n is its third power, that is, the result of multiplying three instances of n together.

Cube (2021 film)
https://en.wikipedia.org/wiki/Cube_(2021_film)

The story centers on a group of strangers who awaken in a cube-shaped room connected to adjacent rooms, forming an elaborate maze filled with traps.

Matches in a table:

CityCompanyPersonNotes
ManchesterBlue Harbor LtdAlice BrownAnnual review completed
LiverpoolMancraft StudioDaniel ReedNew client onboarded
BristolGreenField TechMancini RobertBudget approved
LeedsNorthwind LabsEmma StoneVisit planned for Manchester office
YorkDelta SystemsMichael TurnerContract with Mancorp signed
OxfordSilver BridgeLaura GreenArchived in mancategory B

This style is unobtrusive and ideal for quickly scanning familiar data: the user immediately sees that the searched word is in the row but is not distracted from the main choice.

<span [innerHTML]="item | kbqHighlightBold: searchQuery"></span>

The pipe used to be called mcHighlight: that name is deprecated and will be removed in 22.0.0.

Suggestions for improvement
If you found a mistake or want to improve the article, create an issue on GitHub.