Skip to content

Tab#

Tab #

Tab(
    *,
    label: TemplatedStringItem,
    content: LayoutItem,
    icon: Icons | WidgetField | str | None = None,
    default_selected: bool = False,
)

Represents an individual tab within a TabSection.

Constructor for Tab.

Parameters:

Name Type Description Default
label TemplatedStringItem

label to be displayed in tab.

required
content LayoutItem

item to be added in tab.

required
icon Icons | WidgetField | str | None

tab icon.

None
default_selected bool

set tab as default selected.

False

TabSection #

TabSection(*tabs: Tab)

Organize dashboard content within tabs.

The TabSection class is a crucial part of a dashboard layout, allowing users to organize content within tabs.

Constructor for TabSection.

Parameters:

Name Type Description Default
tabs Tab

tabs to be added to tab section.

()

Examples:#

Create TabSection with different tabs
import pandas as pd

from engineai.sdk.dashboard import layout
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import maps

data = pd.DataFrame(
    data=[{"region": "PT", "value": 10}, {"region": "GB", "value": 100}]
)

tab_1 = layout.Tab(
    label="One Widget",
    content=maps.Geo(data=data)
)
tab_2 = layout.Tab(
    label="Multiple Widgets",
    content=layout.Grid(
        maps.Geo(data=data),
        maps.Geo(data=data)
    )
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=layout.TabSection(tab_1, tab_2),
)

Result: Tab with different tabs