docs/src/xml/xml/overview.rst
.. include:: /include/substitutions.txt .. _xml_overview:
Introduction
LVGL's XML Module implements LVGL's Declarative UI by making it possible to describe UIs in XML.
Using XML instead of pure drag-and-drop editing has several advantages:
The XML file can be written by hand, but it's highly recommended to use LVGL Pro's Editor <editor> to write the XML files. The Editor makes UI development much faster by
providing features like:
Figma <https://www.figma.com/>__ integration to easily reimplement Figma designsUI Elements
It is important to distinguish between :dfn:Widgets, :dfn:Components, and :dfn:Screens.
:dfn:Widgets are the core building blocks of the UI and are not meant to be loaded at runtime
but rather compiled into the application as C code. The main characteristics of Widgets are:
<widget> root element.set/get/add functions.Tabview's tabs, Dropdown's lists).:dfn:Components are simpler UI elements and can be loaded at runtime.
The main characteristics of Components are:
<component> root element.btn_text to a Label's text).Whether the XML was written manually or by the UI |nbsp| Editor, the files defining Components can be registered in LVGL, and after that, instances can be created.
In other words, LVGL can read the XML files, "learn" the Components from them, and thereafter create children as part of Screens and other Components.
:dfn:Screens are similar to Components:
<screen> root element.Screen <screens>.Global data
globals.xml is a special XML file in which globally available
can be defined.
Multiple globals.xml files can be loaded if needed, but each will be saved in the same global scope,
meaning duplicated items will be added only once.
Using the XML Files
The XML files can be used in two ways:
Both use cases are covered in detail in the :ref:Integration <editor_integration>
section.