I’m using the Dash bootstrap component “Accordion” as a navigation tool for my dashboard.
I would like to customize the title of the dbc.AccordionItems. In the documentation I can only find that the title argument is optional and should be a string. However, I would like it to be an Icon or another HTML component.
Is this possible or is the only way to achieve this, to create my own accordion with seperate dbc.collapses ?
Example Code
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
import dash
app = dash.Dash(__name__)
accordion = html.Div(
[
html.Div(
dbc.Accordion(
[
dbc.AccordionItem(
dbc.Nav(
[
dbc.NavLink("Link 1", href=f"/link1/", style = {'color':'black'}),
dbc.NavLink("Link 2", href=f"/link2/", style = {'color':'black'}),
],
vertical=True,
pills=True,
)
, title=f"TITEL" # I would like to customize this with e.g. html.I(classname=...)
)
],
start_collapsed=False,
),
),
],
id="accordion-id",
)
# embedding the navigation bar
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
accordion,
html.Div(id='page-content')
])
app.config.external_stylesheets = [dbc.themes.BOOTSTRAP]
if __name__ == '__main__':
app.run_server(debug=True)```