Is it possible to set clip-paths conditionally on a dash table?

The code below

from dash import Dash
import dash_table
import pandas as pd

df = pd.DataFrame({"data": [1, 2, 3, 4, 5]})
app = Dash(__name__)

app.layout = dash_table.DataTable(
    id="table",
    columns=[{"name": i, "id": i} for i in df.columns],
    data=df.to_dict("records"),
    style_data_conditional=[
        {
            "if": {
                "filter_query": "{data} >= 3",
            },
            "backgroundColor": "yellow",
            "clipPath": "circle()",
        }
    ],
)

if __name__ == "__main__":
    app.run_server(debug=True)

results in this

The clip-path is not added to the inline styles. This is also the case for other style properties like border radius.

But if I add the inline styles manually it does work

Am I missing something or is this not supported?

I could of course add the clipping path via css, but the goal is to conditionally show different shapes based on the data.

Hi @BvdLind

I think that in the new release you can do that using markdown:

See the examples showed by @AnnMarieW in the anouncement:

or goes to the repository to see the examples:

1 Like

Wow that’s great, thank you! I knew about the markdown option, but not that it now also supports html.

2 Likes