# lv_tabview.h (/api/public/widgets/lv_tabview_h)



<RelatedHeaders name="lv_tabview_private.h" isPrivate="false" />

<ApiSummary functions="13" enums="1" variables="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (5)&#x22;,&#x22;Getters (6)&#x22;,&#x22;Other (2)&#x22;]">
  <ApiTab value="Setters (5)">
    <ApiMember kind="function" name="lv_tabview_set_tab_text" file="public/widgets/lv_tabview.h" line="67" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L67">
      lv_tabview_set_tab_text [#lv_tabview_set_tab_text]

      Change the name of the tab

      ```c title=" " lineNumbers=1
      void lv_tabview_set_tab_text(lv_obj_t *obj, uint32_t idx, const char *new_name)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                             | Description                                                                                                                                  |
      | ---------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget                                                                                                                  |
      | `idx`      | `uint32_t`                                       | the index of the tab to rename                                                                                                               |
      | `new_name` | `const char *`                                   | the new name as a string **May** be `NULL`. When NULL the current name is kept and only refreshed, see <ApiLink name="lv_label_set_text" />. |
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_set_tab_translation_tag" file="public/widgets/lv_tabview.h" line="81" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L81">
      lv_tabview_set_tab_translation_tag [#lv_tabview_set_tab_translation_tag]

      Add a tab to the tabview whose label is bound to a translation tag. The tab bar shows the translation of `tag` for the currently selected language, and updates automatically on <ApiLink name="lv_translation_set_language" display="lv_translation_set_language()" />. If no language is selected or the tag is not found in any translation pack, the tag itself is displayed.

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_tabview_set_tab_translation_tag(lv_obj_t *obj, const char *tag)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                                                      |
      | ----- | ------------------------------------------------ | ---------------------------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget                                      |
      | `tag` | `const char *`                                   | '\0' terminated translation key, must be non-NULL and not empty. |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — the widget where the content of the tab can be created
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_set_active" file="public/widgets/lv_tabview.h" line="91" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L91">
      lv_tabview_set_active [#lv_tabview_set_active]

      Show a tab

      ```c title=" " lineNumbers=1
      void lv_tabview_set_active(lv_obj_t *obj, uint32_t idx, lv_anim_enable_t anim_en)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name      | Type                                             | Description                  |
      | --------- | ------------------------------------------------ | ---------------------------- |
      | `obj`     | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget  |
      | `idx`     | `uint32_t`                                       | the index of the tab to show |
      | `anim_en` | <ApiLink name="lv_anim_enable_t" />              | LV\_ANIM\_ON/OFF             |
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_set_tab_bar_position" file="public/widgets/lv_tabview.h" line="98" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L98">
      lv_tabview_set_tab_bar_position [#lv_tabview_set_tab_bar_position]

      Set the position of the tab bar

      ```c title=" " lineNumbers=1
      void lv_tabview_set_tab_bar_position(lv_obj_t *obj, lv_dir_t dir)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                    |
      | ----- | ------------------------------------------------ | ------------------------------ |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget    |
      | `dir` | <ApiLink name="lv_dir_t" />                      | LV\_DIR\_TOP/BOTTOM/LEFT/RIGHT |
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_set_tab_bar_size" file="public/widgets/lv_tabview.h" line="106" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L106">
      lv_tabview_set_tab_bar_size [#lv_tabview_set_tab_bar_size]

      Set the width or height of the tab bar

      ```c title=" " lineNumbers=1
      void lv_tabview_set_tab_bar_size(lv_obj_t *obj, int32_t size)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                                                                                                        |
      | ------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to tabview widget                                                                                          |
      | `size` | `int32_t`                                        | size of the tab bar in pixels or percentage. will be used as width or height based on the position of the tab bar) |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (6)">
    <ApiMember kind="function" name="lv_tabview_get_tab_count" file="public/widgets/lv_tabview.h" line="113" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L113">
      lv_tabview_get_tab_count [#lv_tabview_get_tab_count]

      Get the number of tabs

      ```c title=" " lineNumbers=1
      uint32_t lv_tabview_get_tab_count(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                 |
      | ----- | ------------------------------------------------ | --------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget |

      **Returns:** `uint32_t` — the number of tabs
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_get_tab_active" file="public/widgets/lv_tabview.h" line="120" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L120">
      lv_tabview_get_tab_active [#lv_tabview_get_tab_active]

      Get the current tab's index

      ```c title=" " lineNumbers=1
      uint32_t lv_tabview_get_tab_active(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                 |
      | ----- | ------------------------------------------------ | --------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget |

      **Returns:** `uint32_t` — the zero based index of the current tab
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_get_tab_button" file="public/widgets/lv_tabview.h" line="129" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L129">
      lv_tabview_get_tab_button [#lv_tabview_get_tab_button]

      Get a given tab button by index

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_tabview_get_tab_button(lv_obj_t *obj, int32_t idx)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                                                                                                               |
      | ----- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget                                                                                               |
      | `idx` | `int32_t`                                        | zero based index of the tab button to get. \< 0 means start counting tab button from the back (-1 is the last tab button) |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the tab button, or NULL if the index was out of range
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_get_content" file="public/widgets/lv_tabview.h" line="136" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L136">
      lv_tabview_get_content [#lv_tabview_get_content]

      Get the widget where the container of each tab is created

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_tabview_get_content(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                 |
      | ----- | ------------------------------------------------ | --------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — the main container widget
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_get_tab_bar" file="public/widgets/lv_tabview.h" line="143" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L143">
      lv_tabview_get_tab_bar [#lv_tabview_get_tab_bar]

      Get the tab bar where the buttons are created

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_tabview_get_tab_bar(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                 |
      | ----- | ------------------------------------------------ | --------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — the tab bar
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_get_tab_bar_position" file="public/widgets/lv_tabview.h" line="150" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L150">
      lv_tabview_get_tab_bar_position [#lv_tabview_get_tab_bar_position]

      Get the position of the tab bar

      ```c title=" " lineNumbers=1
      lv_dir_t lv_tabview_get_tab_bar_position(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                 |
      | ----- | ------------------------------------------------ | --------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget |

      **Returns:** <ApiLink name="lv_dir_t" /> — LV\_DIR\_TOP/BOTTOM/LEFT/RIGHT
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (2)">
    <ApiMember kind="function" name="lv_tabview_create" file="public/widgets/lv_tabview.h" line="46" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L46">
      lv_tabview_create [#lv_tabview_create]

      Create a tabview widget

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_tabview_create(lv_obj_t *parent)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                             | Description                                                                                                         |
      | -------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a parent widget **May** be `NULL`.. When NULL, the widget is created as a screen on the default display. |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — the created tabview
    </ApiMember>

    <ApiMember kind="function" name="lv_tabview_add_tab" file="public/widgets/lv_tabview.h" line="57" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L57">
      lv_tabview_add_tab [#lv_tabview_add_tab]

      Add a tab to the tabview

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_tabview_add_tab(lv_obj_t *obj, const char *name)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                                                                                                                                                                                                                   |
      | ------ | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a tabview widget                                                                                                                                                                                                   |
      | `name` | `const char *`                                   | the name of the tab to be displayed on the tab bar **May** be `NULL`. When NULL the tab button's label keeps the default label text (`LV_LABEL_DEFAULT_TEXT`). Useful when the text is set later, e.g. via a translation tag. |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — the widget where the content of the tab can be created
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="_lv_property_tabview_id_t" file="public/widgets/lv_tabview.h" line="29" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L29">
  \_lv_property_tabview_id_t [#_lv_property_tabview_id_t]

  | Name                                   | Value                                                            |
  | -------------------------------------- | ---------------------------------------------------------------- |
  | `LV_PROPERTY_TABVIEW_TAB_ACTIVE`       | `(LV_PROPERTY_TABVIEW_START + ((int) 0 )) \| ((  1   ) <<  28 )` |
  | `LV_PROPERTY_TABVIEW_TAB_BAR_POSITION` | `(LV_PROPERTY_TABVIEW_START + ((int) 1 )) \| ((  1   ) <<  28 )` |
  | `LV_PROPERTY_TABVIEW_END`              |                                                                  |
</ApiMember>

Variables [#variables]

<ApiMember kind="variable" name="lv_tabview_class" file="public/widgets/lv_tabview.h" line="26" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_tabview.h#L26">
  lv_tabview_class [#lv_tabview_class]

  ```c title=" " lineNumbers=1
  const lv_obj_class_t lv_tabview_class
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_obj.h&#x22;, &#x22;lv_obj_property.h&#x22;]" includedBy="[&#x22;lvgl.h&#x22;]" transitiveIncludes="[&#x22;lv_anim.h&#x22;, &#x22;lv_area.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_bidi.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_display.h&#x22;, &#x22;lv_draw.h&#x22;, &#x22;lv_draw_arc.h&#x22;, &#x22;lv_draw_blur.h&#x22;, &#x22;lv_draw_buf.h&#x22;, &#x22;lv_draw_image.h&#x22;, &#x22;lv_draw_label.h&#x22;, &#x22;lv_draw_line.h&#x22;, &#x22;lv_draw_rect.h&#x22;, &#x22;lv_draw_triangle.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_ext_data.h&#x22;, &#x22;lv_flex.h&#x22;, &#x22;lv_font.h&#x22;, &#x22;lv_fs.h&#x22;, &#x22;lv_grad.h&#x22;, &#x22;lv_grid.h&#x22;, &#x22;lv_group.h&#x22;, &#x22;lv_image_decoder.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_indev.h&#x22;, &#x22;lv_layout.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_matrix.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_obj_class.h&#x22;, &#x22;lv_obj_draw.h&#x22;, &#x22;lv_obj_event.h&#x22;, &#x22;lv_obj_pos.h&#x22;, &#x22;lv_obj_scroll.h&#x22;, &#x22;lv_obj_style.h&#x22;, &#x22;lv_obj_style_gen.h&#x22;, &#x22;lv_obj_tree.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_profiler.h&#x22;, &#x22;lv_profiler_builtin.h&#x22;, &#x22;lv_sprintf.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_style.h&#x22;, &#x22;lv_style_gen.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_text.h&#x22;, &#x22;lv_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
