Bar (lv_bar)

A background with an indicator whose length represents a value within a range.

Overview

The Bar has a background and an indicator whose length represents the current value within a range. Both the start and end values can be set, so the indicator can grow from any point, and it animates between values.

Learn more in the LVGL Open documentation.

lv_example_bar.c

Enumerations

lv_bar_mode — How the bar grows with values

ValueDescription
normalMake the bar grow from minimum toward maximum
symmetricalMake the bar grow symmetrically from the midpoint
rangeMake the bar show values between start and end points

lv_bar_orientation — How the bar is oriented

ValueDescription
autoChoose orientation automatically based on widget size
horizontalMake the bar fill left to right
verticalMake the bar fill bottom to top

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 bar's background track: background properties. padding shrinks the indicator in the respective direction.
indicatorThe filled portion that shows the value: background properties.

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

PropertyTypeDescription
min_valueintSet the minimum value of the bar. . If min_value > max_value fills from the right.
max_valueintSet the maximum value of the bar. If min_value > max_value fills from the right
valueintSet the current value of the bar
value-animatedboolAnimate the bar when changing its value. Reference as value-animated (default: false)
start_valueintSet the start value in range mode
start_value-animatedboolAnimate the bar when changing its start value. Reference as start_value-animated (default: false)
modeenum:lv_bar_modeSelect how the bar grows
orientationenum:lv_bar_orientationSelect the bar’s orientation
bind_valuesubjectBind the bar’s value to a subject

Last updated on

On this page