import dash_trich_components as dtc
from dash.dependencies import Input, Output
import pandas as pd
siderbar = html.Div([
dtc.SideBar([
dtc.SideBarItem(id='id_1', label="Label 1", icon="fas fa-home"),
dtc.SideBarItem(id='id_2', label="Label 2", icon="fas fa-chart-line"),
dtc.SideBarItem(id='id_3', label="Label 3", icon="far fa-list-alt"),
dtc.SideBarItem(id='id_4', label="Label 4", icon="fas fa-info-circle"),
dtc.SideBarItem(id='id_5', label="Label 5", icon="fas fa-cog"),
]),
])
app.layout = dbc.Container(
fluid=False,
children=[
Header("title", app),
html.Hr(),
siderbar,
]
), html.Div([dcc.Link(id='page_link', href='', target='_blank')])
@app.callback(
Output("page_link", "href"),
[
Input("id_1", "n_clicks_timestamp"),
Input("id_2", "n_clicks_timestamp"),
Input("id_3", "n_clicks_timestamp"),
Input("id_4", "n_clicks_timestamp"),
Input("id_5", "n_clicks_timestamp")
]
)
def toggle_collapse(input1, input2, input3, input4, input5):
btn_df = pd.DataFrame({"input1": [input1], "input2": [input2],
"input3": [input3], "input4": [input4],
"input5": [input5]})
btn_df = btn_df.fillna(0)
if btn_df.idxmax(axis=1).values == "input1":
return 'https://www.google.com'
if btn_df.idxmax(axis=1).values == "input2":
return 'https://www.youtube.com'
if btn_df.idxmax(axis=1).values == "input3":
return 'https://www.naver.com'
if btn_df.idxmax(axis=1).values == "input4":
return 'https://www.naver.com'
if btn_df.idxmax(axis=1).values == "input5":
return 'https://www.naver.com'
hi @myidksh
I can’t get this code to run on my computer. But it’s important to note that dash-trich-components is a pretty old library that hasn’t been worked on in over 2 years. The last commit was in June 2021, so I would be surprised if there were some incompatibility with current versions of Dash and Dash Bootstrap Component.