LVGL Pro

repository·master·Indexed 20 days ago

https://github.com/lvgl/lvgl_editor

A professional UI development suite for building embedded user interfaces using the LVGL library. It provides a visual and declarative workflow via XML, featuring a desktop editor, CLI, and online preview tools. The suite bridges designers and developers through Figma integration and a component-based system that supports custom properties, data binding, and automated UI testing.

Tokens
84.4K
Snippets
225
Records
433
Agent score
70%

What's inside lvgl_editor

  1. Overview of LVGL Pro workflow

    master

    LVGL Pro is a professional development environment designed to accelerate LVGL UI development. It provides a workflow that sits on top of the open-source LVGL library, allowing developers to design, develop, test, and debug embedded UIs using an LVGL-native editor, Figma integration, and CLI tools.

    Key benefits include:

    • Instant Iteration: Real-time previews as you edit XML.
    • Maintainability: Building screens from reusable components with custom properties and public APIs.
    • Multi-target Support: Managing different resolutions, hardware configurations, or architectures within a single project.
    • Designer-Developer Collaboration: Using the Figma Flow to export designs directly into the project and sharing interactive UIs via the Online Viewer.
    • Automated Testing: Using the CLI to run UI tests and generate screenshots in CI/CD pipelines.
  2. Overview of LVGL Pro Editor

    master

    The LVGL Pro Editor is a visual development environment for building embedded UIs. It is part of the LVGL Pro toolkit, which includes a CLI, Figma plugin, and online viewer.

    Key capabilities include:

    • Real-time preview: Pixel-perfect rendering using real LVGL to match device output.
    • XML Editing: Full control over UI structure with autocomplete and syntax highlighting.
    • Design Mode: Drag-and-drop visual editing for building screens.
    • C Code Generation: Exporting optimized C code for firmware integration.
    • Advanced Features: Support for custom widgets, data bindings, UI testing, animations, and multi-language translations.
    • Figma Integration: Exporting designs directly from Figma to XML via a plugin.
  3. Overview of LVGL Pro Main Tools

    master

    LVGL Pro is a professional toolkit designed to streamline embedded UI development through four primary components:

    • XML Editor: A visual editor with autocomplete for describing UI components, screens, tests, animations, and data bindings. It provides pixel-perfect previews and C code export.
    • Online Share: A web-based version of the Editor that loads XML files directly from GitHub repositories, allowing for UI sharing without local installation.
    • CLI: A command-line interface used for validating XML files, generating C code, and executing UI tests within CI/CD pipelines.
    • Figma Plugin: A tool to extract and synchronize style properties from Figma designs into the Editor or via the CLI.
  4. Use the LED widget (lv_led)

    master

    The LED widget is a rectangle or circle used to simulate a glowing indicator. Its appearance is driven by a single color, which controls the background, border, and shadow. The brightness of the LED is adjusted to simulate the glow effect.

    To use an LED, you can define its color and its brightness level. Lowering the brightness darkens the entire component.

    // Example usage via the built-in example
    lv_example_led();
  5. Navigate the LVGL Flow plugin interface

    master

    The plugin interface is organized into a header and several functional modes:

    • Mode Toggle: Located at the top of the header, used to switch between Project, Annotate, Export, and Inspect modes.
    • Project Identity: Displays your connected project's name and branch on the left side of the header.
    • Connection Status: A status dot glows green when the plugin and service are successfully connected.
    • Connection Tools: The plug icon allows you to open connection details, while the log button provides access to logs.
  6. Use the Switch (lv_switch) widget

    master

    The Switch is a small slider widget used to display and toggle an on/off value. By default, it is oriented horizontally, but it automatically switches to a vertical orientation if its width becomes smaller than its height. You can manually control this behavior using the orientation property.

    /* See lv_example_switch for a full implementation example */
  7. Use the Roller widget (lv_roller)

    master

    The Roller is a wheel-like list widget used to pick a single item from a list by scrolling. The item positioned in the center band is considered the selected item and is typically styled differently to indicate selection.

    To use a Roller, you can define its options, set the number of visible rows, and choose between normal or infinite scrolling modes.

    <!-- Example conceptual XML usage -->
    <lv_roller 
      options="Option 1, Option 2, Option 3" 
      visible_row_count="3" 
      options-mode="normal" />
  8. Use the Label widget to display text

    master

    The Label widget is used to display text in the UI. It supports advanced features such as line wrapping, long-text overflow modes (scrolling, clipping, or ellipsis), per-word recoloring using color codes, and binding text to subjects using printf-style formatting.

    <lv_label text="Hello World" />
  9. Understand the LVGL Pro Project Template structure

    master

    The basic project template provides a pre-configured design system and component library for LVGL Pro. It is configured for a 480 × 320 display using lvgl_version 9.5.0.

    Key directories include:

    • globals.xml: The design system containing spacing, shape constants, colors, fonts, styles, and data binding subjects (e.g., theme, brightness).
    • components/: Reusable wrappers for layouts (base_box, container, panel, row, column), typography (h1h5, text), controls (button, slider, arc, bar, switch, checkbox, dropdown, text_input, text_box, keyboard), and lists (list, list_item, list_section, list_separator).
    • screens/: Contains screen_components.xml, a demo screen illustrating component usage.
    • fonts/: Includes compiled Montserrat fonts (Regular, Medium, SemiBold, Bold).
    • images/icons/: Lucide icons provided as SVG, which are rasterized via the <convert> tag.
    • tests/: XML-based UI tests.
  10. Use the Span Group (lv_spangroup) widget

    master

    The lv_spangroup widget is used to display rich text composed of multiple spans. Each span can have its own unique font, color, and size. Spans can be dynamically added or removed at runtime to create complex, multi-styled text blocks.

    <lv_spangroup>
      <lv_spangroup-span text="Hello " style="color:red" />
      <lv_spangroup-span text="World" style="color:blue; font_size:20" />
    </lv_spangroup>
  11. Understand the exported project structure

    master

    When you export from the service, it generates an LVGL project in your configured projectDir. The structure is organized to match LVGL's component layout and separates design tokens, components, screens, and assets.

    Directory Map

    your-project/
    ├── project.xml                     # project root: display size, required
    ├── globals.xml                     # tokens: colors, fonts, images, styles
    ├── components/
    │   ├── card_summary/
    │   │   └── card_summary.xml        # one folder per component
    │   ├── nav_button/
    │   │   └── nav_button.xml
    │   └── base/
    │       └── …                       # shared base library (row, column, panel, h1–h4)
    ├── screens/
    │   ├── screen_home.xml             # one file per screen, safe-named
    │   └── screen_settings.xml
    ├── images/
    │   └── logo.png                    # extracted image + vector assets
    ├── fonts/
    │   └── FONTS-MISSING.md            # written only when a font can't be resolved
    └── .lvgl-flow/                     # internal state, leave it alone

    Key Files and Ownership

    FileDescriptionOwnership
    project.xmlThe project root containing the <display> block.Service-owned
    globals.xmlContains design tokens (colors, numbers, strings, fonts, styles). Rewritten on every export that includes tokens.Service-owned
    components/<name>/<name>.xmlNested folder per component. Variants are handled as states inside the XML.Service-owned
    components/base/A demand-driven library of layout primitives (row, column, panel) used by your components.Service-owned
    screens/<name>.xmlNormalized screen files.User/Service
    images/<name>.pngExtracted images and vector fills, re-encoded to PNG for LVGL compatibility.User/Service
    .lvgl-flow/Internal bookkeeping (manifests, asset sidecars, name records). Do not edit manually.Service-owned
    your-project/
    ├── project.xml
    ├── globals.xml
    ├── components/
    │   ├── card_summary/
    │   │   └── card_summary.xml
    │   ├── nav_button/
    │   │   └── nav_button.xml
    │   └── base/
    │       └── …
    ├── screens/
    │   ├── screen_home.xml
    │   └── screen_settings.xml
    ├── images/
    │   └── logo.png
    ├── fonts/
    │   └── FONTS-MISSING.md
    └── .lvgl-flow/