---
title: "How to use tabs"
description: "Use `Tabs` to let users switch between multiple `Container`s that share the same screen space, and add a tooltip to the tab strip."
source_url: "https://vizro.readthedocs.io/en/stable/pages/user-guides/tabs/"
agent_docs: "Index: https://vizro.readthedocs.io/en/stable/llms.txt; full documentation: https://vizro.readthedocs.io/en/stable/llms-full.txt"
---

# How to use tabs

This guide shows you how to use the [`Tabs`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Tabs "            Tabs


  
      pydantic-model
  ") model, which organize and separate groups of related content in a dashboard, letting users switch between different sections or views.

When to use this

Choose `Tabs` to let users switch between several [`Container`s](https://vizro.readthedocs.io/en/stable/pages/user-guides/container/) that share the same screen space. To group components into a single visible section, use a [`Container`](https://vizro.readthedocs.io/en/stable/pages/user-guides/container/) directly; to arrange components on the page as a whole, use [`Page.layout`](https://vizro.readthedocs.io/en/stable/pages/user-guides/layouts/).

**API reference:** [`Tabs`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Tabs "            Tabs


  
      pydantic-model
  ")

They are essentially a way of putting multiple [`Container`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Container "            Container


  
      pydantic-model
  ") models in the same screen space, and letting the user switch between them. A [`Container`](https://vizro.readthedocs.io/en/stable/pages/user-guides/container/) enables the grouping of page components into sections and subsections. The [`Tabs`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Tabs "            Tabs


  
      pydantic-model
  ") model is based on the underlying Dash component [`dbc.Tabs`](https://www.dash-bootstrap-components.com/docs/components/tabs/).

![tabs](https://vizro.readthedocs.io/en/stable/assets/user_guides/components/tabs-info.png)

Displaying multiple containers in Tabs

Both `Tabs` and `Containers` are a more advanced technique for customizing your page layout. If you want to arrange components on a page, we recommend reading our [user guide on layouts](https://vizro.readthedocs.io/en/stable/pages/user-guides/layouts/) first.

This guide shows you how to use tabs to organize your `Containers` into subsections inside the dashboard.

By using the [`Tabs`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Tabs "            Tabs


  
      pydantic-model
  ") model, the following applies:

- [Filters](https://vizro.readthedocs.io/en/stable/pages/user-guides/filters/) affect all components on all tabs (opened and closed) of the page if not specified otherwise inside `Filter.targets`
- The `title` of the [`Container`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Container "            Container


    
        pydantic-model
    ") inserted into `Tabs.tabs` will be displayed as a tab label, and the title will be removed from the `Container`

## Add tabs

To add a [`Tabs`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Tabs "            Tabs


  
      pydantic-model
  ") model to your page, do the following:

1. Insert the [`Tabs`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Tabs "            Tabs


     
         pydantic-model
     ") model into the `components` argument of the [`Page`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Page "            Page


     
         pydantic-model
     ") model
2. Insert your [`Container`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Container "            Container


     
         pydantic-model
     ") models into the `tabs` argument of the `Tabs` model
3. Add a `title` to the `Container`, which will be used as the `label` for the corresponding `Tab`.
4. (optional) Add a `title` to the `Tabs` model to display a heading above your `Tabs`.

Tabs

app.pyapp.yamlResult

```python
import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro

gapminder_2007 = px.data.gapminder().query("year == 2007")

page = vm.Page(
    title="Tabs",
    components=[
        vm.Tabs(
            title="Tabs Title",
            tabs=[
                vm.Container(
                    title="Tab I",
                    components=[
                        vm.Graph(
                            figure=px.bar(
                                gapminder_2007,
                                title="Graph 1",
                                x="continent",
                                y="lifeExp",
                                color="continent",
                            ),
                        ),
                        vm.Graph(
                            figure=px.box(
                                gapminder_2007,
                                title="Graph 2",
                                x="continent",
                                y="lifeExp",
                                color="continent",
                            ),
                        ),
                    ],
                ),
                vm.Container(
                    title="Tab II",
                    components=[
                        vm.Graph(
                            figure=px.scatter(
                                gapminder_2007,
                                title="Graph 3",
                                x="gdpPercap",
                                y="lifeExp",
                                size="pop",
                                color="continent",
                            ),
                        ),
                    ],
                ),
            ],
        ),
    ],
)

dashboard = vm.Dashboard(pages=[page])
Vizro().build(dashboard).run()
```

```yaml
# Still requires a .py to add data to the data manager and parse YAML configuration
# See yaml_version example
pages:
  - components:
    - type: tabs
      title: Tabs Title
      tabs:
        - title: Tab I
          type: container
          components:
            - type: graph
              figure:
                _target_: bar
                data_frame: gapminder_2007
                title: Graph 1
                x: continent
                y: lifeExp
                color: continent
            - type: graph
              figure:
                _target_: box
                data_frame: gapminder_2007
                title: Graph 2
                x: continent
                y: lifeExp
                color: continent
        - title: Tab II
          type: container
          components:
            - type: graph
              figure:
                _target_: scatter
                data_frame: gapminder_2007
                title: Graph 3
                x: gdpPercap
                y: lifeExp
                size: pop
                color: continent
    title: Tabs
```

The dashboard renders the "Tabs" example.

[![Tabs](https://vizro.readthedocs.io/en/stable/assets/user_guides/components/tabs.png)](https://vizro.readthedocs.io/en/stable/assets/user_guides/components/tabs.png)

## Add a tooltip

The `description` argument enables you to add helpful context to your tabs by displaying an info icon next to its title. Hovering over the icon shows a tooltip with your chosen text.

You can provide [Markdown text](https://markdown-guide.readthedocs.io/) as a string to use the default info icon or a [`Tooltip`](https://vizro.readthedocs.io/en/stable/pages/API-reference/models/#vizro.models.Tooltip "            Tooltip


  
      pydantic-model
  ") model to use any icon from the [Google Material Icons library](https://fonts.google.com/icons).

Tabs with tooltip

app.pyapp.yamlResult

```python
import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro

gapminder_2007 = px.data.gapminder().query("year == 2007")

page = vm.Page(
    title="Tabs",
    components=[
        vm.Tabs(
            title="Tabs Title",
            description="""
                The Iris dataset includes measurements of 150 iris flowers across three types: Setosa, Versicolor, and Virginica.

                While all samples are labeled by type, they can appear similar when looking at just some features—making it a useful dataset for exploring patterns and challenges in classification.
            """,
            tabs=[
                vm.Container(
                    title="Tab I",
                    components=[
                        vm.Graph(
                            figure=px.bar(
                                gapminder_2007,
                                title="Graph 1",
                                x="continent",
                                y="lifeExp",
                                color="continent",
                            ),
                        ),
                        vm.Graph(
                            figure=px.box(
                                gapminder_2007,
                                title="Graph 2",
                                x="continent",
                                y="lifeExp",
                                color="continent",
                            ),
                        ),
                    ],
                ),
                vm.Container(
                    title="Tab II",
                    components=[
                        vm.Graph(
                            figure=px.scatter(
                                gapminder_2007,
                                title="Graph 3",
                                x="gdpPercap",
                                y="lifeExp",
                                size="pop",
                                color="continent",
                            ),
                        ),
                    ],
                ),
            ],
        ),
    ],
)

dashboard = vm.Dashboard(pages=[page])
Vizro().build(dashboard).run()
```

```yaml
# Still requires a .py to add data to the data manager and parse YAML configuration
# See yaml_version example
pages:
  - components:
    - type: tabs
      title: Tabs Title
      description: |
            The Iris dataset includes measurements of 150 iris flowers across three types: Setosa, Versicolor, and Virginica.

            While all samples are labeled by type, they can appear similar when looking at just some features—making it a useful dataset for exploring patterns and challenges in classification.
      tabs:
        - title: Tab I
          type: container
          components:
            - type: graph
              figure:
                _target_: bar
                data_frame: gapminder_2007
                title: Graph 1
                x: continent
                y: lifeExp
                color: continent
            - type: graph
              figure:
                _target_: box
                data_frame: gapminder_2007
                title: Graph 2
                x: continent
                y: lifeExp
                color: continent
        - title: Tab II
          type: container
          components:
            - type: graph
              figure:
                _target_: scatter
                data_frame: gapminder_2007
                title: Graph 3
                x: gdpPercap
                y: lifeExp
                size: pop
                color: continent
    title: Tabs
```

The dashboard renders the "Tabs with tooltip" example.

[![TabsInfoIcon](https://vizro.readthedocs.io/en/stable/assets/user_guides/components/tabs-info-icon.png)](https://vizro.readthedocs.io/en/stable/assets/user_guides/components/tabs-info-icon.png)
