Hi @rajat, and welcome to the Dash community!
You could try using a bootstrap progress bar or button group:
You can find more info here: https://dash-bootstrap-components.opensource.faculty.ai/docs/components/progress/
Here are two examples::
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = html.Div(
[
dcc.Interval(id="progress-interval", n_intervals=0, interval=100),
dbc.Progress(id="progress_bar"),
dbc.ButtonGroup(
[
dbc.Button(
"stage " + str(i),
id="stage" + str(i),
style={"border": None, "border-radius": "50%"},
className="m-5",
)
for i in range(1, 5)
],
size="lg",
),
],
)
@app.callback(
[Output("progress_bar", "value"), Output("progress_bar", "children")],
[Input("progress-interval", "n_intervals")],
)
def update_progress_bar(n):
# check progress of some background process, in this example we'll just
# use n_intervals constrained to be in 0-100
progress = min(n % 110, 100)
# only add text after 5% progress to ensure text isn't squashed too much
return progress, f"{progress} %" if progress >= 5 else ""
@app.callback(
[Output("stage" + str(i), "color") for i in range(1, 5)],
[Input("progress-interval", "n_intervals")],
)
def update_stage_button(n):
progress = min(n % 110, 100)
stage_number = progress // 25
stages = ["white", "white", "white", "white"] # startup colors
stage_colors = ["primary", "success", "warning", "info"]
stages[:stage_number] = stage_colors[:stage_number] # update colors to show step
return stages
if __name__ == "__main__":
app.run_server(debug=True)