Skip to content
Jeff Day edited this page Aug 22, 2026 · 2 revisions

Wire name label

Static text. It takes no focus, no input, and raises no events — the simplest trinket there is, and the one you reach for to caption everything else.

new label caption="Find what:"

Properties

Property Type Default Meaning
caption string Displayed text (may contain newlines).
text_align left | center | right Text alignment within the label.
wrap flag false Word-wrap text (enables height-for-width).

Plus the common properties.

caption may contain newlines, which break lines whether or not wrap is set. The caption is painted verbatim: no & mnemonic markup, no escapes.

Events

label emits no events.

A label is not interactive. To make text that responds, use a Button — a flat one reads as a link.

text_align is not align

Two different questions, which is why they are two names.

Asks
text_align where the text sits inside the label
align (common) where the label sits inside the space its parent gave it

A label narrower than its slot with text_align=center centers its text within the label's own box, which may itself be sitting at the left of the row. If you want the text centered in the row, the label has to fill the row — align=fill (the default) — or be centered as an item with align=center.

Wrapping

Without wrap, a label is one line per newline and takes whatever width that needs. With wrap, it word-wraps and becomes height-for-width: its height depends on how wide it ends up.

The same forty-three-character label:

Width Height
80 units (10 columns) 80 units (5 rows)
160 units (20 columns) 48 units (3 rows)

That is what "enables height-for-width" means in the table — the layout asks the label how tall it needs to be at the width it is about to get, instead of using one fixed size hint. A wrapping label in a vbox therefore grows taller when the window narrows, and the layout accounts for it.

Note that the reported size hint does not reflect wrapping; it stays the single-line width. The height-for-width query is what the layout actually uses.

Behavior

Focus. None. A label is skipped by Tab and cannot be clicked into. It is the only one of the basic trinkets that takes no focus at all.

Accessibility. A label announces its text. Where a label captions another trinket, that trinket usually wants its own acc_name too — the association is visual, and a screen reader reading them in sequence is not the same as knowing they belong together.

See also

Button · TextInput · Common Properties

Clone this wiki locally