# Getting Started (/examples/get_started)



These examples introduce the core workflow: creating a label, attaching a click callback to a button, applying styles, and reading a slider value through an event. Begin here if you have not written an LVGL program before. Once the patterns feel familiar, move on to Styles and Events for deeper coverage.

Button with click counter [#button-with-click-counter]

<LvglExampleBrief>
  Increment a label on a button each time it is clicked.
</LvglExampleBrief>

A button sized 120x50 is placed at position (10, 10) on the active screen
with a centered label reading `Button`. The button subscribes to
`LV_EVENT_ALL` and on `LV_EVENT_CLICKED` the callback updates its child
label with `lv_label_set_text_fmt` to show an incrementing counter.

<LvglExample name="lv_example_get_started_button" path="get_started/lv_example_get_started_button" />

Hello world label [#hello-world-label]

<LvglExampleBrief>
  Paint the screen background and center a label on it.
</LvglExampleBrief>

The view sets its own `style_bg_color` to a dark teal and `style_text_color`
to white. The label sets no color of its own — it inherits white from the
view — and `align="center"` places it in the middle of the display.

<LvglExample name="lv_example_get_started_hello_world" path="get_started/get_started_hello_world/lv_example_get_started_hello_world" />

Slider with live value [#slider-with-live-value]

<LvglExampleBrief>
  Mirror a slider's value into a label through a shared subject.
</LvglExampleBrief>

The slider writes its position to `subject_value` with `bind_value`, and the
label reads the same subject with `bind_text` + `bind_text-fmt="%d"`. Because
both refer to one subject, dragging the slider updates the label with no event
callback — the binding keeps the two in sync.

<LvglExample name="lv_example_get_started_slider" path="get_started/get_started_slider/lv_example_get_started_slider" />

Styles from scratch for buttons [#styles-from-scratch-for-buttons]

<LvglExampleBrief>
  Build named button styles, then add a pressed state and an accent variant.
</LvglExampleBrief>

`style_button` is the shared base: a rounded vertical grey gradient with a thin
translucent border. The first button adds `style_button_pressed` on the
`pressed` selector so its gradient darkens while held. The second stacks
`style_button_red` to repaint only the gradient and sets a local circular
radius, showing how a small style plus one local property re-skins a button
without redefining the base.

<LvglExample name="lv_example_get_started_styles" path="get_started/get_started_styles/lv_example_get_started_styles" />
