Hi everyone,
In my code i was able to change the ‘disable’ state of dbc.Tab based on the availability of calculated results. This doesn’t work anymore and i’m wondering if it’s related to recently updating to Dash 3.0.1, combined with dash-bootstrap-components 2.0.0 ? Below is a simplified example:
import dash
import dash_bootstrap_components as dbc
from dash import dcc, html
from dash.dependencies import Input, Output
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = html.Div([
html.Button('Enable Tabs', id='button', n_clicks=0),
dcc.Store(id='store-data', data=None),
dbc.Tabs(
[
dbc.Tab(label='Tab A', tab_id='tab-a', id='tab-a', disabled=True),
dbc.Tab(label='Tab B', tab_id='tab-b', id='tab-b', disabled=True),
],
id='tabs',
active_tab='tab-a'
)
])
@app.callback(
Output('store-data', 'data'),
Input('button', 'n_clicks')
)
def update_store_data(clicks):
if clicks > 0:
return {"data": "available"}
return None
@app.callback(
[
Output('tab-a', 'disabled'),
Output('tab-b', 'disabled')
],
Input('store-data', 'data')
)
def toggle_tabs(store_data):
if store_data is not None and "data" in store_data:
return False, False
return True, True
if __name__ == '__main__':
app.run_server(debug=True)
Variable ‘store-data’ is populated after a button is clicked, and the change in ‘store-data’ should enable the tabs.