Mr. President
Mr. President

Reputation: 1549

Change appearance of links with plotly/dash

I'm working with Dash to build a dashboard. Consider the following code:

def get_index():
    index = html.Div([
        dcc.Link('Page 1', href='/page-1'),
        html.Br(),
        dcc.Link('Page 2', href='/page-2')
    ], style = {'display':'inline-block','columnCount': 2})
    return index

This gives me the following output in my app:

enter image description here

Question: How do I remove the bar below the links and change the font and color?

Thanks!

Upvotes: 1

Views: 6130

Answers (1)

Maximilian Peters
Maximilian Peters

Reputation: 31659

You can customize the links by adding style as a named argument, e.g.

dcc.Link('Page 1', href='/page-1', 
         style={'font-family': 'Times New Roman, Times, serif', 'font-weight': 'bold'})

The style argument is just regular CSS.

Adding external CSS to your Dash app is preferable in my opinion because you can separate code logic and layout.

Upvotes: 3

Related Questions