Skip to content
Twentyfirst UIPro

Highlight

Foundations · Highlight, TextField

View as Markdown

Marks search terms in a text, for search hits in mail, chat and lists. query marks each word of the input (case-insensitive), exact the whole input as one phrase, and terms a list you pass. highlightParts(text, terms) returns the parts for your own markup.

Invoice RE-2026-00041 for the November retainer is overdue.

The offsite moves to the lake house; invoices go to finance.

Draft of the hiring plan with the new design roles.

Props

Highlight

PropTypeNotes
textstringRequired
query?stringSearch input: each word is marked (or the whole input with `exact`).
terms?string[]The terms to mark, instead of `query`.
exact?booleanMarks `query` as one phrase instead of word by word.
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

TextField

PropTypeNotes
type?stringInput type (`"text"` by default): `"email"`, `"number"`, `"tel"`, `"url"`, `"password"` …
icon?IconName
suffix?ReactNode
value?string
defaultValue?string
placeholder?string
disabled?boolean
readOnly?boolean
autoComplete?string
autoFocus?boolean
min?number | stringSmallest value for `type="number"`, `"date"` and the like (native `min`).
max?number | stringLargest value (native `max`).
step?number | stringStep between valid values (native `step`), e.g. `1` for whole numbers or `"any"`.
minLength?numberFewest characters (native `minlength`).
maxLength?numberMost characters (native `maxlength`).
pattern?stringPattern the value must match (native `pattern`).
inputMode?"none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search"Virtual keyboard on touch devices (native `inputmode`), e.g. `"numeric"` or `"decimal"`.
onChange?(e: ChangeEvent<HTMLInputElement>) => void
onBlur?(e: ChangeEvent<HTMLInputElement>) => void
onKeyDown?(e: KeyboardEvent<HTMLInputElement>) => void
action?ReactNodeAn interactive control at the end of the field (an `IconButton`: clear, copy, locate …). Unlike `suffix` it can be clicked, and it stays when the field shows an error or success mark.
reveal?booleanFor `type="password"`: a button that shows and hides the password (default true).
label?string
hint?string
error?string