1.. zephyr:code-sample:: lvgl-demos
2   :name: LVGL demos
3   :relevant-api: display_interface
4
5   Run LVGL built-in demos.
6
7Overview
8********
9
10A sample showcasing upstream LVGL demos.
11
12* Music
13      The music player demo shows what kind of modern, smartphone-like user interfaces can be created on LVGL.
14* Benchmark
15      The benchmark demo tests the performance in various cases. For example rectangle, border, shadow, text, image blending, image transformation, blending modes, etc.
16* Stress
17      A stress test for LVGL. It contains a lot of object creation, deletion, animations, styles usage, and so on. It can be used if there is any memory corruption during heavy usage or any memory leaks.
18* Widgets
19      Shows how the widgets look like out of the box using the built-in material theme.
20* Flex Layout
21      Showcases the use of the flex layout.
22* Keypad and Encoder
23      Shows how to control widget with a keypad and hardware encoder.
24* Render
25      Collection of multiple rendering tests.
26* Scroll
27      Shows the scroll behaviour of a panel with a large list.
28* Multilang
29      Shows a UI with multilanguage options, supporting unicode characters.
30
31More details can be found in `LVGL demos Readme`_.
32
33Requirements
34************
35
36* A board with display, ideally with 480x272 resolution or higher.
37* A pointer input device: touchpad, mouse, or touch screen capable display, compatible with :dtcompatible:`zephyr,lvgl-pointer-input`.
38
39Note that other input devices types are not demonstrated in these demos, namely keyboards, keypads (:dtcompatible:`zephyr,lvgl-keypad-input`), rotary encoders (:dtcompatible:`zephyr,lvgl-encoder-input`) and hardware buttons (:dtcompatible:`zephyr,lvgl-button-input`).
40
41Building and Running
42********************
43
44Example building for :zephyr:board:`mimxrt1060_evk`:
45
46.. zephyr-app-commands::
47   :zephyr-app: samples/modules/lvgl/demos
48   :board: mimxrt1060_evk
49   :goals: build flash
50
51These demos can be built for simulated display environment as follows:
52
53.. zephyr-app-commands::
54   :zephyr-app: samples/modules/lvgl/demos
55   :host-os: unix
56   :board: native_sim
57   :gen-args: -DCONFIG_LV_Z_DEMO_MUSIC=y
58   :goals: run
59   :compact:
60
61.. zephyr-app-commands::
62   :zephyr-app: samples/modules/lvgl/demos
63   :host-os: unix
64   :board: native_sim
65   :gen-args: -DCONFIG_LV_Z_DEMO_BENCHMARK=y
66   :goals: run
67   :compact:
68
69.. zephyr-app-commands::
70   :zephyr-app: samples/modules/lvgl/demos
71   :host-os: unix
72   :board: native_sim
73   :gen-args: -DCONFIG_LV_Z_DEMO_STRESS=y
74   :goals: run
75   :compact:
76
77.. zephyr-app-commands::
78   :zephyr-app: samples/modules/lvgl/demos
79   :host-os: unix
80   :board: native_sim
81   :gen-args: -DCONFIG_LV_Z_DEMO_WIDGETS=y
82   :goals: run
83   :compact:
84
85.. zephyr-app-commands::
86   :zephyr-app: samples/modules/lvgl/demos
87   :host-os: unix
88   :board: native_sim
89   :gen-args: -DCONFIG_LV_Z_DEMO_FLEX_LAYOUT=y
90   :goals: run
91   :compact:
92
93.. zephyr-app-commands::
94   :zephyr-app: samples/modules/lvgl/demos
95   :host-os: unix
96   :board: native_sim
97   :gen-args: -DCONFIG_LV_Z_DEMO_KEYPAD_AND_ENCODER=y
98   :goals: run
99   :compact:
100
101.. zephyr-app-commands::
102   :zephyr-app: samples/modules/lvgl/demos
103   :host-os: unix
104   :board: native_sim
105   :gen-args: -DCONFIG_LV_Z_DEMO_RENDER=y
106   :goals: run
107   :compact:
108
109.. zephyr-app-commands::
110   :zephyr-app: samples/modules/lvgl/demos
111   :host-os: unix
112   :board: native_sim
113   :gen-args: -DCONFIG_LV_Z_DEMO_SCROLL=y
114   :goals: run
115   :compact:
116
117.. zephyr-app-commands::
118   :zephyr-app: samples/modules/lvgl/demos
119   :host-os: unix
120   :board: native_sim
121   :gen-args: -DCONFIG_LV_Z_DEMO_MULTILANG=y
122   :goals: run
123   :compact:
124
125Alternatively, if building from a 64-bit host machine, the previous target
126board argument may also be replaced by ``native_sim/native/64``.
127
128References
129**********
130
131.. target-notes::
132
133.. _LVGL demos Readme: https://github.com/zephyrproject-rtos/lvgl/blob/zephyr/demos/README.md
134