Drop-down List (lv_dropdown)

Shows a selected value and opens a list to pick one option.

Overview

The Drop-down List shows a single selected value and, when activated, opens a list of options for the user to pick from. The list closes automatically once a new option is selected.

Learn more in the LVGL Open documentation.

Properties

Parts

Style parts of the widget with local style (e.g. style_bg_color-knob="0xff0000") or with style sheets (e.g. <style name="style_knob" selector="knob">). See Styles to learn more.

PartDescription
mainThe closed button: background and text properties. Gets the 'checked' state while the list is open.
indicatorThe symbol shown next to the text (set via symbol): image_recolor and image_recolor_opa.

Properties below are the widget's XML <api>; see API for how properties, parameters and elements work.

PropertyTypeDescription
textstringSet text displayed instead of the selected option label
optionsstringSet options as a newline (\n) separated string
selectedintSelect an option by index (0-based)
symbolimageSet a symbol shown next to the dropdown
bind_valuesubjectBind the selected option index to a subject
direnum:lv_dirTells in which direction the dropdown should be opened

<lv_dropdown-list>

The dropdown list object for styling or customization

access get · returns lv_obj

Parts

PartDescription
mainThe open list background: background, border and padding. max_height caps the open list size.
scrollbarThe list's scrollbar: width (thickness), background properties and padding on the respective side.
selectedThe highlighted option: background and text properties. The 'checked' state styles the currently selected option and 'pressed' the one being pressed/keyed.

No attributes — created as an empty child.

Last updated on

On this page