Dash|Plotly: Conditional formatting append a className

Viewed 269

I'd like to add a css className conditionally to a cell of a dash_table.DataTable.

The reason for this is that I don't want to repeat the css properties, which are already defined in a css. Updating the code just because some color in a css changes is cumbersome.

I found conditionally formatting. But the documentation says one can only add css properties:

The if keyword provides a set of conditional formatting statements and the rest of the keywords are camelCased CSS properties.

eg:

{
    'if': {
        'column_id': 'Region',
    },
    'backgroundColor': 'dodgerblue',
    'color': 'white'
    'className': 'my-class' <- This does not work!
},

How can I dynamically add css classes to Dash elements?

0 Answers
Related