Documentation / Widgets / Controller / Image Button

Image Button

A button drawn from images rather than a box. Each state is its own asset, so a press swaps the picture instead of tinting it — which is the only way to press a button that already glows, since a tint over a glow reads as a fault rather than a press. Only Released is required; every other slot falls back to it.

The checked slots need the widget to be checkable before LVGL will ever put it in that state: tick Checkable under Flags in the Inspector. Without it the checked art is compiled in and never drawn. A checkable image button is how one control does play and stop — see NEON DECK, whose transport is exactly that.

Group: Controller · Default size: 100 × 50 · Style parts: Main

A dropped Image Button with no pictures yet: a faint placeholder box with a picture symbol.
An Image Button as it is dropped, before it has pictures.
The Image Button settings section: Button state Released, Image released power-off.png, Image pressed none, Image checked power-on.png, Image checked pressed and Image disabled none.
Its settings, with a picture for released and one for checked.
SettingDefaultWhat it does
Button stateReleasedWhich state to show on the canvas and at start: Released, Pressed, Disabled and their Checked variants.
Image released(none)The resting picture, and the fallback for every slot below that is empty.
Image pressed(none)Shown while a finger is on it.
Image checked(none)Shown once it is checked. Needs the Checkable flag, or the widget never reaches that state.
Image checked pressed(none)Pressed while checked. Falls back to the checked image.
Image disabled(none)Shown while the widget is disabled — set by the Set state action or by lv_obj_add_state.

Example: a power key that stays lit

  1. On the Assets tab press Add image twice and add the two pictures of the key: power-off.png and power-on.png, both 72 x 72.
  2. Drag an Image Button onto the screen and name it PowerKey. Under Image Button settings set Image released to power-off.png and Image checked to power-on.png. Give it a Width and Height of 72.
  3. Open Flags and tick Checkable, or it never reaches the checked state.
  4. Press Preview and click the key: it lights and stays lit. Click it again and it goes out.
A round grey key with a white power symbol in the middle of the screen.
Released.
Preview: the same key lit orange with a glow.
Clicked in Preview: checked, so the other picture.
The Flags section with Checkable ticked.
Checkable, under Flags.