plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
20.99k stars 2.03k forks source link

dcc.Input type="color" raises error #2772

Open luggie opened 5 months ago

luggie commented 5 months ago

dcc.Input(type="color")

is implemented and works correctly. However the components description, doc string (except for on ReadOnly section) and type checking is not up to date as it raises:

Invalid argument `type` passed into Input with ID "set-color-input".
Expected one of ["text","number","password","email","range","search","tel","url","hidden"].
Value provided: "color"
alexcjohnson commented 5 months ago

Thanks @luggie (transferred the issue to dash, dcc has been merged in here so the other repo is obsolete)

When you say it's implemented, you mean it works correctly if you disable prop checking? If so, we should be able to just add color as an option here:

https://github.com/plotly/dash/blob/e580ff0dc09e169411cef901f7b8122407503159/components/dash-core-components/src/components/Input.react.js#L221-L232

We will want to check on the comment // Only allowing the input types with wide browser compatibility - perhaps when we first wrote this component color was poorly supported but now it's close to universal?

AnnMarieW commented 5 months ago

One issue with adding the color prop is that if someone clicks and drags on the color picker, it will fire the callback a bazillion times. Not sure if there is a way to prevent that, or maybe just recommend people use this option in a clientside callback only?

alexcjohnson commented 5 months ago

dcc.Input has a debounce prop, which should help with that.

luggie commented 5 months ago

When you say it's implemented, you mean it works correctly if you disable prop checking? If so, we should be able to just add color as an option here:

yep, that's what I thought

qlandman commented 3 weeks ago

Would it also be possible to also add the date type as an alternative for the Dash DatePicker?