So dbc.Tabs has a functionality where if no specific active tabs are mentioned, it takes the starting index.
active_tab
(string ; optional): The tab_id of the currently active tab. If tab_id has not been specified for the active tab, this will default to tab-i, where i is the index (starting from 0) of the tab.
But I am looking if there is something similar in dcc.Tabs also.
I am developing a dashboard of sorts, and I am displaying graphs inside tabs.The user specifies which ids to display the graphs of (can start from any value, not necessarily 0 or 1) The number of tabs, the label, id,value are all dynamic based on user input and it is created in a loop. I also have a functionality where the user can execute a custom filter in the graphs, this is where my confusion starts.
Since the user input cannot be predicted, I cannot specify which tab value should be the default active tab in dcc.Tabs. But for development, I just specified tab-1 as default. But if id number 1 is not part of user input, none of the tabs are selected.
tab_elements.append(
dcc.Tab(
label=f"Topic{index}",
value=f"topic-{index}",
children=wordcloud_element,
style=tab_style,
selected_style=tab_selected_style
)
)
tabs = (
dcc.Tabs(
value=f"topic-1",
children=tab_elements,
style=tabs_styles
),
)
in dbc.Tabs, the first tab in the list is automatically displayed regardless of what the user input was. But upon the filter function, the tabs are unselected.
However this same problem does not occur in dcc.Tabs if the default active tab is among the user input. I’m not sure how to solve this