---
title: highlight
description: >-
  Split text into matched and plain runs, so results render highlights without
  HTML.
updated_at: '2026-09-25T10:30:03+02:00'
created_at: '2026-09-25T10:30:03+02:00'
symbol:
  kind: function
  name: highlight
  signatures:
    - >-
      highlight(text: string, terms: readonly string[]):
      [[reference/api/ui/TextSegment|TextSegment]][]
  parameters:
    - name: text
      type: string
    - name: terms
      type: 'readonly string[]'
  returns:
    type: '[[reference/api/ui/TextSegment|TextSegment]][]'
  source: >-
    https://github.com/mia-cx/svartz/blob/711f3906a713c8b9a5a572d0f34c85e90c3bc3d1/packages/ui/src/lib/search.ts#L46
---

# highlight
