Tabview (lv_tabview)


The Tab view object can be used to organize content in tabs. The Tab view is built from other widgets:

The tab buttons can be positioned on the top, bottom, left and right side of the Tab view.

A new tab can be selected either by clicking on a tab button or by sliding horizontally on the content.

Parts and Styles

There are no special parts on the Tab view but the lv_obj and lv_btnnmatrix widgets are used to create the Tab view.


Create a Tab view

lv_tabview_create(parent, tab_pos, tab_size); creates a new empty Tab view. tab_pos can be LV_DIR_TOP/BOTTOM/LEFT/RIGHT to position the tab buttons to a side. tab_size is the height (in case of LV_DIR_TOP/BOTTOM) or width (in case of LV_DIR_LEFT/RIGHT) tab buttons.

Add tabs

New tabs can be added with lv_tabview_add_tab(tabview, "Tab name"). This will return a pointer to an lv_obj object where the tab's content can be created.

Rename tabs

A tab can be renamed with lv_tabview_rename_tab(tabview, tab_id, "New Name").

Change tab

To select a new tab you can:

  • Click on its tab button

  • Slide horizontally

  • Use lv_tabview_set_act(tabview, id, LV_ANIM_ON/OFF) function

Get the parts

lv_tabview_get_content(tabview) returns the container for the tabs, lv_tabview_get_tab_btns(tabview) returns the Tab buttons object which is a Button matrix.


  • LV_EVENT_VALUE_CHANGED Sent when a new tab is selected by sliding or clicking the tab button. lv_tabview_get_tab_act(tabview) returns the zero based index of the current tab.

Learn more about Events.


Keys have effect only on the tab buttons (Button matrix). Add manually to a group if required.

Learn more about Keys.




lv_obj_t *lv_tabview_create(lv_obj_t *parent, lv_dir_t tab_pos, lv_coord_t tab_size)
lv_obj_t *lv_tabview_add_tab(lv_obj_t *tv, const char *name)
void lv_tabview_rename_tab(lv_obj_t *obj, uint32_t tab_id, const char *new_name)
lv_obj_t *lv_tabview_get_content(lv_obj_t *tv)
lv_obj_t *lv_tabview_get_tab_btns(lv_obj_t *tv)
void lv_tabview_set_act(lv_obj_t *obj, uint32_t id, lv_anim_enable_t anim_en)
uint16_t lv_tabview_get_tab_act(lv_obj_t *tv)


const lv_obj_class_t lv_tabview_class
struct lv_tabview_t

Public Members

lv_obj_t obj
char **map
uint16_t tab_cnt
uint16_t tab_cur
lv_dir_t tab_pos