Tab View (lv_tabview)

The Tab View Widget can be used to organize content in tabs.

Edit on GitHub

Overview

The Tab View Widget 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 base widget and Button (lv_button) Widgets are used to create the Tab View.

Usage

Creating a Tab View

lv_tabview_create(parent) creates a new empty Tab View.

Adding tabs

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

Renaming tabs

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

To select a new tab you can:

Setting tab bar position

Using the lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT/RIGHT/TOP/BOTTOM) the tab bar can be moved to any side.

Setting tab bar size

The size of the tab bar can be adjusted by lv_tabview_set_tab_bar_size(tabview, size). When tabs are on the top or bottom, this means the height of the tab bar, and when they are on the sides, it means the width.

Accessing the parts

Events

Further Reading

Learn more about Events emitted by all Widgets.

Learn more about events.

Keys

Keys have effect only on the tab buttons. Programmatically add these buttons to a group if required.

Further Reading

Learn more about Keys.

Examples

Simple Tabview

Tabs on the left, styling and no scrolling

API

How is this guide?

Last updated on

On this page