> For the complete documentation index, see [llms.txt](https://docs.uibakery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uibakery.io/reference/working-with-components/text-annotate.md).

# Text Annotate

## Overview

A text field used for highlighting and tagging text.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FBzhwniDQryj7NcdivlLW%2FCleanShot%202025-09-09%20at%2016.12.40%402x-min.png?alt=media&amp;token=1463b163-a34b-4195-9231-70409d43b2c9" alt=""><figcaption></figcaption></figure>

### Properties

<table><thead><tr><th width="174.140625">Name</th><th width="248.96484375">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td><code>string</code></td><td>Component name</td></tr><tr><td><code>annotations</code></td><td><code>UITextAnnotation[]</code></td><td>An array of annotation objects</td></tr><tr><td><code>addedAnnotation</code></td><td><code>TextAnnotationAddedEvent</code></td><td>Last added annotation event</td></tr><tr><td><code>removedAnnotation</code></td><td><code>TextAnnotationRemovedEvent</code></td><td>Last removed annotation event</td></tr></tbody></table>

### Methods

<table><thead><tr><th width="147.203125">Name</th><th width="239.953125">Parameters</th><th width="104.7421875">Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>setTags</code></td><td><code>tags: string[] |</code> <br><br><br><code>object[]</code>   </td><td><code>void</code></td><td><p>Set component tags. Tags is an array of strings or objects with the following structure:</p><p><code>{</code><br></p><p><code>label: string;</code></p><p><code>key: string;</code></p><p><code>color: string</code></p><p><code>}</code> </p></td></tr><tr><td><code>setText</code></td><td><code>value: string</code></td><td><code>void</code></td><td>Set component text setting</td></tr><tr><td><code>setAnnotations</code></td><td><code>annotations: object[]</code>   </td><td><code>void</code></td><td>Set component annotations setting. Annotations is an array of object with the following structure:<br><code>{</code><br><code>startIndex: number;</code><br><code>endIndex: number;</code><br><code>key: string;</code><br><code>label: string</code><br><code>text: string</code><br><code>}</code></td></tr></tbody></table>

### Triggers

<table><thead><tr><th width="207.3125">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>On Init</strong></td><td>Triggered when the component is initialized</td></tr><tr><td><strong>On Change</strong></td><td>Triggered when the component's state changes</td></tr><tr><td><strong>On Annotation Add</strong></td><td>Triggered when an annotation is added</td></tr><tr><td><strong>On Annotation Remove</strong></td><td>Triggered when an annotation is removed</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uibakery.io/reference/working-with-components/text-annotate.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
