The text highlighter question allows respondents to mark one or more sections of a passage by selecting and highlighting text. This question type is useful for understanding which phrases, ideas, or statements stand out to respondents.
Other Names and Formats
A Text Highlighter Question is also called a highlight question, text selection question, or text markup task. Respondents select phrases or passages in a supplied text sample, and the selected text is recorded for analysis.
How it works
Respondents are shown a block of text. They can drag to select any portion of the text, which is then highlighted using the configured color. Multiple, non-contiguous selections are supported.
Each selection is recorded as a nonempty, case-sensitive substring of the passage, and the question returns the selections as a ListResponse.
Survey Experience
- Respondents can highlight one or more parts of the passage before continuing.
- Every selection must be a nonempty, case-sensitive substring of
text_to_highlight; empty strings, missing substrings, and non-string selections are rejected. - The highlight color is configurable with the
coloroption.
| Traditional Experience | Traditional Mobile Optimized | Chat Experience |
|---|---|---|
![]() | ![]() | ![]() |
Explicit Don't know response
Set dont_know_option="Don't know" to offer an explicit opt-out for the whole question. It is exclusive of highlighted selections. The response is a singleton list containing the configured label, even though that label is not a substring of the source text.
Configuration Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
dont_know_option | str | no | '' | Optional explicit opt-out label; per row for grids, otherwise for the whole question |
question | string | yes | - | The prompt shown to the user |
text_to_highlight | string | yes | - | The text from which respondents can select and highlight portions |
color | string | no | #FFFF00 (yellow) | Highlight color as exactly six hexadecimal digits prefixed by #; letter case is ignored. Other values raise SurveyValidationError |
default | str, list[str], or list[list[str]] | no | random highlights | Default highlights for test data: a string for one highlight, a list of strings for one full highlight response, or a list of highlight-list candidates — each simulated respondent picks one at random |
number_seconds | int | no | 0 | Seconds to wait before allowing the respondent to continue |
tags | s.tag() | no | - | Used to fill tokens in text and group questions in reports |
id | str | None | no | None | Optional stable identifier for this question |
Example Code
from survey import Survey
s = Survey(**globals())
s.text_highlighter_question(
"Please highlight the parts of the following text that you find most interesting:",
text_to_highlight="The quick brown fox jumps over the lazy dog."
)



