1 2# Tabview (lv_tabview) 3 4## Overview 5 6The Tab view object can be used to organize content in tabs. 7The Tab view is built from other widgets: 8- Main container: [lv_obj](/widgets/obj)) 9 - Tab buttons: [lv_btnmatrix](/widgets/core/btnmatrix) 10 - Container for the tabs: [lv_obj](/widgets/obj) 11 - Content of the tabs: [lv_obj](/widgets/obj) 12 13The tab buttons can be positioned on the top, bottom, left and right side of the Tab view. 14 15A new tab can be selected either by clicking on a tab button or by sliding horizontally on the content. 16 17## Parts and Styles 18There are no special parts on the Tab view but the `lv_obj` and `lv_btnnmatrix` widgets are used to create the Tab view. 19 20## Usage 21 22### Create a Tab view 23 24`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. 25`tab_size` is the height (in case of `LV_DIR_TOP/BOTTOM`) or width (in case of `LV_DIR_LEFT/RIGHT`) tab buttons. 26 27### Add tabs 28 29New tabs can be added with `lv_tabview_add_tab(tabview, "Tab name")`. This will return a pointer to an [lv_obj](/widgets/obj) object where the tab's content can be created. 30 31### Rename tabs 32 33A tab can be renamed with `lv_tabview_rename_tab(tabview, tab_id, "New Name")`. 34 35### Change tab 36 37To select a new tab you can: 38- Click on its tab button 39- Slide horizontally 40- Use `lv_tabview_set_act(tabview, id, LV_ANIM_ON/OFF)` function 41 42### Get the parts 43 44`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](/widgets/core/btnmatrix). 45 46## Events 47- `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. 48 49Learn more about [Events](/overview/event). 50 51## Keys 52 53Keys have effect only on the tab buttons (Button matrix). Add manually to a group if required. 54 55Learn more about [Keys](/overview/indev). 56 57## Example 58 59```eval_rst 60 61.. include:: ../../../examples/widgets/tabview/index.rst 62 63``` 64 65## API 66 67```eval_rst 68 69.. doxygenfile:: lv_tabview.h 70 :project: lvgl 71 72``` 73