Skip to content

[BUG] Upload component styling using HTML classes #3246

Closed
@jburtscher

Description

@jburtscher

As far as I can tell, the className_* properties in the upload component don't seem to have any effect (I'm using Dash 3.0.1 on Windows with Edge Version 134.0.3124.83).
With the following app and CSS file, the upload component is colored yellow but does not change color when I drag files onto it (be it one file for the active case or multiple files for the rejected case):

from dash import Dash, dcc

app = Dash()
app.layout = dcc.Upload(
    "Upload",
    className="upload",
    className_active="upload-active",
    className_reject="upload-reject",
)
app.run(debug=True)
.upload { background: yellow; }
.upload-active { background: green; }
.upload-reject { background: red; }

If I use the style_* properties, everything works fine:

from dash import Dash, dcc

app = Dash()
app.layout = dcc.Upload(
    "Upload",
    style={"background": "yellow"},
    style_active={"background": "green"},
    style_reject={"background": "red"},
)
app.run(debug=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions