Skip to content

Collapsible#

CollapsibleSection #

CollapsibleSection(
    *,
    content: LayoutItem,
    header: TemplatedStringItem
    | CollapsibleSectionHeader
    | None = None,
    expanded: bool = True,
)

Organize and group content with expandable/collapsible sections.

The CollapsibleSection class is used to create collapsible sections within a dashboard layout, providing a way to organize and group content that can be expanded or collapsed.

Constructor for CollapsibleSection.

Parameters:

Name Type Description Default
content LayoutItem

content within the Section. One of Widget, Card, Grid, SelectableSection.

required
header TemplatedStringItem | CollapsibleSectionHeader | None

Header specifications. By default the CollapsibleSection does not have title

None
expanded bool

Whether the section is expanded or not.

True

Examples:#

Create Collapsible Section with widget
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}]
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=layout.CollapsibleSection(content=maps.Geo(data=data))
)

Result: Collapsible Section with widget

Create Collapsible Section with multiple widgets
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}]
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=layout.CollapsibleSection(
        content=layout.Grid(
            maps.Geo(data=data),
            maps.Geo(data=data)
        )
    )
)

Result: Collapsible Section with multiple widgets

CollapsibleTabSection #

CollapsibleTabSection(
    *tabs: CollapsibleTab, expanded: bool = False
)

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.

CollapsibleSectionHeader #

CollapsibleSectionHeader(
    *chips: CollapsibleSectionChip,
    title: TemplatedStringItem | None = None,
)

Provides title and chips for collapsible section headers.

The CollapsibleSectionHeader class represents the header of a collapsible section, providing additional information such as title and chips.

Constructor for CollapsibleSectionHeader.

Parameters:

Name Type Description Default
chips CollapsibleSectionChip

chips to be added to the collapsible section header.

()
title TemplatedStringItem | None

Collapsible Section title.

None

Examples:#

Create Collapsible Section with title
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}]
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=layout.CollapsibleSection(
        header=layout.CollapsibleSectionHeader(
            title="My Collapsible Map"
        ),
        content=maps.Geo(data=data)
    )
)

Result: Collapsible Section with title

CollapsibleSectionChip #

CollapsibleSectionChip(
    *,
    label: str | GenericLink,
    tooltip_text: list[TemplatedStringItem] | None = None,
    prefix: str = "",
    suffix: str = "",
)

Labels or links within collapsible section headers for extra context.

The CollapsibleSectionChip class represents individual chips within a collapsible section header, providing additional labels or links.

Constructor for CollapsibleSectionChip.

Parameters:

Name Type Description Default
label str | GenericLink

Collapsible Section Header label value. Can assume a static label.

required
tooltip_text list[TemplatedStringItem] | None

informational pop up text. Each element of list is displayed as a separate paragraph. Can only use this option if the label is set.

None
prefix str

prefix value to use in before each label.

''
suffix str

suffix value to use in after each label.

''

Examples:#

Create Collapsible Section with multiple chips
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}]
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=layout.CollapsibleSection(
        header=layout.CollapsibleSectionHeader(
            layout.CollapsibleSectionChip(label="Chip 1"),
            layout.CollapsibleSectionChip(label="Chip 2"),
            layout.CollapsibleSectionChip(label="Chip 3")
        ),
        content=maps.Geo(data=data)
    ),
)

Result: Collapsible Section with multiple chips