Label
Label bind text
Bind a label to a string subject; buttons rewrite the subject on click.
subject_text is a string subject from examples/xml_project/globals.xml. The
label uses bind_text to listen for changes. Each button carries a
<subject_set_string_event> child that, on click, writes a fixed value into
subject_text — and the label re-renders automatically.
Label long modes
Show every long_mode behavior side by side.
Five labels share the same width but use different long_mode values: wrap, dots, scroll, scroll_circular, and clip. Each label is colored differently and contains text that does not fit on a single line, so the mode-specific behavior is immediately visible.
Label text recolor
Recolor individual words via inline color tags.
With recolor="true", segments wrapped as "#RRGGBB ... #" render in the given color. This lets a single label mix multiple colors in one string without splitting it into separate label widgets.
Label set text with newlines
Insert explicit line breaks into a label's text.
In XML attributes the entity produces a newline; using two of them in a row leaves a blank line between paragraphs. The second label demonstrates that the text attribute also accepts plain text with no escaping for normal characters.
Label styling
Decorate labels with background, padding, border, outline, and shadow.
A label is just text, but it inherits the full background/border/outline/shadow stack
from the base widget. The named "badge" style turns a label into a pill via radius +
padding + bg color; the second label demonstrates the same effect built purely from
local style_* attributes for a one-off look.
Label text alignment
Align multi-line text inside a fixed-width label.
Three labels of equal width hold the same two-line text but use different style_text_align values: left, center, and right. Alignment only changes anything when the label is wider than its text or contains line breaks, so each label is given an explicit width that exceeds the longest line.
Label with translation tag
Bind a label to a translation tag so its text follows the active language.
lv_label_set_translation_tag ties the label to a key in the
translation table. After lv_translation_set_language is called with
a new language code, every label bound to a tag re-renders with the
translated string. Translations themselves are registered in a CSV
(or XML) through lv_translation_add_static/lv_translation_load.
Last updated on