Parts and States

Parts

Widgets are built from multiple parts. For example, a Base Widget has "main" and "scrollbar" parts, while a Slider has "main", "indicator", and "knob" parts. Parts are similar to pseudo-elements in CSS.

The following predefined parts exist in LVGL:

The main purpose of parts is to allow styling individual "components" of a widget. They are described in more detail in the Style overview section.

States

A widget can be in a combination of the following states:

States are usually changed automatically by the library as the user interacts with a widget (e.g., pressing, releasing, focusing). However, states can also be modified manually. To set or clear a given state (while leaving other states untouched), use:

In both cases, you can bit-wise OR multiple state values. For example: lv_obj_add_state(widget, LV_STATE_PRESSED | LV_STATE_CHECKED)

To learn more about states, see the related section in Styles Overview.