Skip to content

[BUG] Dash 3 dcc.Tab cannot be updated in a callback #3252

@AnnMarieW

Description

@AnnMarieW

It looks like the component is not being re-rendered when a prop in the dcc.Tab component is updated in a callback.

As reported on the forum This app works in dash 2.18.2 but not in dash 3.0.1

import dash
from dash import dcc, html, Input, Output

app = dash.Dash()

app.layout = html.Div(
    [
        html.Button("Enable Tabs", id="button", n_clicks=0),
        dcc.Store(id="store-data", data=None),
        dcc.Tabs(
            [
                dcc.Tab(label="Tab A", value="tab-a", id="tab-a", disabled=True),
                dcc.Tab(label="Tab B", value="tab-b", id="tab-b", disabled=True),
            ],
            id="tabs",
            value="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(debug=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions