Slider (lv_slider)

A Bar with a draggable knob; supports range and symmetrical modes.

Overview

The Slider is a Bar with a draggable knob. It can be horizontal or vertical and supports normal, symmetrical and two-knob range modes.

Learn more in the LVGL Open documentation.

Enumerations

lv_slider_mode — How the slider behaves

ValueDescription
normalOne knob, grows left to right
rangeTwo knobs, select a range
symmetricalIndicator grows from zero

lv_slider_orientation — How the slider oriented

ValueDescription
autoDecide based on width an height
horizontalAlways horizontally
verticalAlways vertical

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 track/background: background properties. padding makes the indicator smaller in the respective direction.
indicatorThe filled portion that shows the value: background properties.
knobThe draggable handle: background, border, shadow and padding properties. Use knob|pressed for drag feedback; range mode draws two knobs.

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

PropertyTypeDescription
min_valueintSet minimum value. If min_value > max_value fills from the right
max_valueintSet maximum value. If min_value > max_value fills from the right
valueintSet current value
value-animboolAnimate update (reference as value-anim) (default: false)
start_valueintSet start value in range mode
start_value-animboolAnimate update (reference as start_value-anim) (default: false)
modeenum:lv_slider_modeSet slider mode
bind_valuesubjectBind value to subject
orientationenum:lv_slider_orientationSet the orientation to horizontal, vertical or auto

Last updated on

On this page