AnnotatedText
In-text glossary terms with HoverCard tips — BrandFg ink, stay-open panels.
A lotusui extension: highlight terms in body copy and preview a tip on hover.
SplitGlossary segments the string (longest match wins);
AnnotatedText paints terms in BrandFg and opens a
HoverCard when a card identity is provided.
Tooltip is the wrong tool — inverted string tips do not stay open on the panel.
HoverCard defaults stay 320dp / 700ms; compact UIs set Width, OpenDelay,
and Side on each card.
Installation
Use the module import (the default), or own the source: lotusui add
vendors the component into your app and lotusui update keeps the copy mergeable —
see Registry.
go get github.com/ikaito-com/lotusui
# or vendor the source into your app:
go run github.com/ikaito-com/lotusui/cmd/lotusui add annotated-text
Usage
Neutral glossary terms (API, SLA) — one HoverCard per term identity; multi-site Layout covers repeats.
terms := []lotusui.GlossaryTerm{
{Term: "API", Tip: "Application Programming Interface"},
{Term: "SLA", Tip: "Service Level Agreement"},
}
var api, sla lotusui.HoverCard
api.Width, sla.Width = 200, 200
api.OpenDelay, sla.OpenDelay = 400*time.Millisecond, 400*time.Millisecond
api.Side, sla.Side = lotusui.HoverCardTop, lotusui.HoverCardTop
lotusui.AnnotatedText(th,
"The API must meet the SLA under load.",
terms, []*lotusui.HoverCard{&api, &sla})
SplitGlossary
Pure segmentation — longest literal match wins when spans collide.
lotusui.SplitGlossary(text, terms)
API
| Option | Type | Description |
|---|---|---|
GlossaryTerm | struct | Term (literal) + Tip (Caption in the card). |
SplitGlossary | func | []GlossarySeg — plain vs term runs. |
AnnotatedText | widget | BrandFg terms; cards[i] for terms[i] (nil / short slice = ink only). |