# List (lv_list) (/widgets/list)



Overview [#overview]

<Callout type="warning" title="Deprecated">
  The `lv_list` widget is deprecated and kept only for backward compatibility. A
  list is just a flex container with a column flow, so build one directly from
  `lv_obj` with a `LV_FLEX_FLOW_COLUMN` layout instead. See the
  [`lv_example_flex_list`](/common-widget-features/layouts/flex#building-a-list)
  example for a starting point.
</Callout>

The List is a vertical container. You add full-width buttons and text rows
to it; the layout takes care of stacking them.

Styling [#styling]

**Background**

* <ApiLink name="LV_PART_MAIN" /> The main part of the List that uses the
  [typical background style properties](/common-widget-features/styles/overview).
* <ApiLink name="LV_PART_SCROLLBAR" /> The scrollbar. See [base widget](/widgets/base_widget)
  documentation for details.

**Buttons and Text**

* See the [Button](/widgets/button)'s and [Label](/widgets/label)'s documentation.

Buttons [#buttons]

<ApiLink name="lv_list_add_button" display="lv_list_add_button(list, icon, text)" /> adds a full-width button with an icon
(that can be an image or symbol) and text.  This function returns a pointer to the
button created, which you can use to, for example, add an event call-back.

The text is scrolled horizontally if it is longer than the button.

Text [#text]

<ApiLink name="lv_list_add_text" display="lv_list_add_text(list, text)" /> adds a text string.  This function returns a
pointer to the label created, which you can use to, for example, change its text
with one of the `lv_label_set_text...()` functions.

Examples [#examples]

Simple List [#simple-list]

<LvglExample name="lv_example_list_sections" path="widgets/list/lv_example_list_sections" />

Sorting a List using up and down buttons [#sorting-a-list-using-up-and-down-buttons]

<LvglExample name="lv_example_list_reorder" path="widgets/list/lv_example_list_reorder" />
