Label (lv_label)

The widget used to display text, with wrapping and long-text modes.

Overview

The Label is the widget used to display text. It supports line wrapping, several long-text modes (scroll, dots, clip), per-word recoloring, and binding its text to a subject with printf-style formatting.

Learn more in the LVGL Open documentation.

Enumerations

lv_label_long_mode — How to handle text that doesn’t fit

ValueDescription
wrapWrap to next line
scrollScroll horizontally
scroll_circularScroll continuously in a loop
clipClip at the boundary
dotsShow dots (…) at the end

Properties

Parts

Style parts of the widget with local style (e.g. style_bg_color-knob="0xff0000") or with style sheets (e.g. <style name="style_knob" selector="knob">). See Styles to learn more.

PartDescription
mainStyle the text and its area: text properties (text_color, text_font, text_letter_space, text_line_space, text_decor, text_align) plus background/padding if needed.
selectedStyle the highlighted character range (text_selection_start/end). Only text_color and bg_color are used.

Properties below are the widget's XML <api>; see API for how properties, parameters and elements work.

PropertyTypeDescription
textstringSet label text
translation_tagstringSet translation tag
long_modeenum:lv_label_long_modeChoose overflow mode
recolorboolAllow recoloring words like: A #ff0000 red# word.
text_selection_startintBeginning of text highlight
text_selection_endintEnd of text highlight
bind_textsubjectBind text to a subject
bind_text-fmtstringFormat string for bound text (printf style) (default: NULL)

Last updated on

On this page