# Label (/examples/widgets/label)



Wrapping and circular scrolling labels [#wrapping-and-circular-scrolling-labels]

<LvglExampleBrief>
  Two labels share a width, one wraps with inline recolor and one scrolls in a loop.
</LvglExampleBrief>

The top label sets `LV_LABEL_LONG_MODE_WRAP`, enables recolor so `#RRGGBB text#`
markers change color per word, fixes the width to 150 px, and center-aligns text
with `LV_TEXT_ALIGN_CENTER`. The bottom label uses
`LV_LABEL_LONG_MODE_SCROLL_CIRCULAR` with the same width so its text cycles
through continuously.

<LvglExample name="lv_example_label_1" path="widgets/label/lv_example_label_1" />

Faux text shadow from two labels [#faux-text-shadow-from-two-labels]

<LvglExampleBrief>
  Layer two labels with the same text to fake a drop shadow.
</LvglExampleBrief>

A background label receives a style that sets `text_opa` to `LV_OPA_30` and a
black `text_color`, then the same text is placed on a foreground label centered
on the screen. The shadow label is aligned to the main label's top-left with a
2 px x/y offset via `lv_obj_align_to`.

<LvglExample name="lv_example_label_2" path="widgets/label/lv_example_label_2" />

LTR, RTL, and CJK labels [#ltr-rtl-and-cjk-labels]

<LvglExampleBrief>
  Three labels rendered with scripts that need different fonts and base directions.
</LvglExampleBrief>

An English label at the top-left uses `lv_font_montserrat_16`. A Hebrew label
in the middle sets `base_dir` to `LV_BASE_DIR_RTL` and renders with
`lv_font_dejavu_16_persian_hebrew`. A Simplified Chinese label at the
bottom-left renders with `lv_font_source_han_sans_sc_16_cjk`. All three wrap at
310 px.

<LvglExample name="lv_example_label_3" path="widgets/label/lv_example_label_3" />

Gradient-filled text via bitmap mask [#gradient-filled-text-via-bitmap-mask]

<LvglExampleBrief>
  Render text with a gradient fill by masking a gradient rectangle.
</LvglExampleBrief>

A canvas in `LV_COLOR_FORMAT_L8` is used as an alpha mask: a centered label is
drawn onto it with `lv_draw_label` using `lv_font_montserrat_24`. A plain
object sized 150x60 is created, given a horizontal red-to-blue background
gradient with `LV_GRAD_DIR_HOR`, and the mask is applied through
`lv_obj_set_style_bitmap_mask_src` so only the text shape shows through.

<LvglExample name="lv_example_label_4" path="widgets/label/lv_example_label_4" />

Customized circular scroll timing [#customized-circular-scroll-timing]

<LvglExampleBrief>
  Set delays and infinite repeats on a label's circular scroll animation.
</LvglExampleBrief>

An `lv_anim_t` template is configured with a 1000 ms initial delay, a 3000 ms
repeat delay, and `LV_ANIM_REPEAT_INFINITE`. A style stores the template via
`lv_style_set_anim` and is attached to a 150 px wide label running in
`LV_LABEL_LONG_MODE_SCROLL_CIRCULAR`, which applies the timing whenever the
scroll animation fires.

<LvglExample name="lv_example_label_5" path="widgets/label/lv_example_label_5" />

Monospace font via glyph override [#monospace-font-via-glyph-override]

<LvglExampleBrief>
  Clone a proportional font and force fixed advance width on each glyph.
</LvglExampleBrief>

A copy of `lv_font_montserrat_20` is made and its `get_glyph_dsc` callback is
replaced with a helper that sets `adv_w` to 20 and recenters `ofs_x` for every
glyph. Two labels render the string `0123.Wabc`: the first with the original
proportional font, the second with the patched monospace clone so column
alignment becomes visible.

<LvglExample name="lv_example_label_6" path="widgets/label/lv_example_label_6" />

Label translation tags with dropdown [#label-translation-tags-with-dropdown]

<LvglExampleBrief>
  Switch label text between English, German, and Spanish from a dropdown.
</LvglExampleBrief>

A static translation table keyed by the tags `tiger`, `lion`, `rabbit`, and
`elephant` is registered with `lv_translation_add_static`. A dropdown lists
the three languages and its `LV_EVENT_VALUE_CHANGED` handler calls
`lv_translation_set_language` with the selected string. One label per tag is
created with `lv_label_set_translation_tag`, and all labels refresh to the
chosen language.

<LvglExample name="lv_example_label_7" path="widgets/label/lv_example_label_7" />
