Tabs

Tabs give the option to separate elements further by grouping them, and only showing a handfull each time. Tabs reset the order so they can be thinked of as subpaths but work as components so they are very versatile! In the following images we can see that groups of components with complex behaviour (bentobox and grid behaviour) are being rendered correctly:

Usage

To use it you just have to define the location of the chart the same way you define the menu, it needs a tabs group name and the name of the tab where it will be inserted:

s.plt.set_tabs_index((tabs_group_name, tab_name))
...  # Charts
s.plt.pop_out_of_tabs_group()

The function is called s.plt.set_tabs_index and it has the parameters:

tabs_index: Tuple[str, str]                          # The tab to be used
order: Optional[int] = None                          # The order in the menu path
parent_tabs_index: Optional[Tuple[str, str]] = None  # The parent tabs group
padding: Optional[str] = None                        # Padding in the view
cols_size: Optional[str] = None                      # Horizontal size
rows_size: Optional[int] = None                      # Vertical size
just_labels: Optional[bool] = None                   # Visual variant
sticky: Optional[bool] = None                        # Follow the scroll or not

To change the tab being used the function s.plt.change_current_tab has to be used, an example on how to use the tabs functionality:

s.plt.set_tabs_index(('Charts', 'Indicators Tab'), order=0)

s.plt.indicator(
    order=0, data={
        "description": "",
        "title": "",
        "value": "Indicator",
        "color": "warning"
    }
)
s.plt.change_current_tab('Bars Tab')
s.plt.bar(
    x='date', order=0, data=[
        {'date': dt.date(2021, 1, 1), 'x': 5, 'y': 5},
        {'date': dt.date(2021, 1, 2), 'x': 6, 'y': 5},
        {'date': dt.date(2021, 1, 3), 'x': 4, 'y': 5},
        {'date': dt.date(2021, 1, 4), 'x': 7, 'y': 5},
        {'date': dt.date(2021, 1, 5), 'x': 3, 'y': 5}
    ]
)

s.plt.pop_out_of_tabs_group()

Positioning & Style Variants

Tabs can stick to the top of the screen when scrolling by setting the parameter sticky to True. They also have two variants, one where they are enclosed:

and one where they are separated:

Recursive Inclusion

Tabs groups can be included in other tabs groups, this brings a lot of flexibility on the separation of information and distribution of elements. To use this functionality the parameter parent_tabs_index has to be used to inform where to include the tabs group.

The different styles of tabs can be useful to differentiate between shallower and deeper tabs, the following example uses two types of tabs:

s.plt.set_tabs_index(('Gauge Indicators Head', 'Lorem ispum'), order=0)

s.plt.gauge_indicator(
    order=0, value=random.randint(0, 100),
    title='Lorem ispum', description='Lorem ispum',
)
s.plt.set_tabs_index(('Gauge Indicators', 'Lorem ispum'), order=0, just_labels=True,
                     parent_tabs_index=('Gauge Indicators Head', 'Lorem ispum'))

s.plt.gauge_indicator(
    order=0, value=random.randint(0, 100),
    title='Lorem ispum', description='Lorem ispum',
)

s.plt.pop_out_of_tabs_group()

Last updated