Skip to content

Commit 55d10c6

Browse files
Added colorpicker example to docs
1 parent 8843f77 commit 55d10c6

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

docs/components_page/components/input.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ If you need more granular control over checkboxes and radio buttons, you can als
9292

9393
{{example:components/input/radio_check_standalone.py:standalone_radio_check}}
9494

95+
## Color picker
96+
97+
When using `Input` with `type="color"`, the user may specify a color, either by using a visual color picker or by entering the color in a text field in #rrggbb format.
98+
99+
Note that the color picker presentation may vary substantially from one browser and/or platform to another.
100+
101+
{{example:components/input/colorpicker.py:colorpicker}}
102+
103+
95104
{{apidoc:src/components/input/Input.js}}
96105

97106
{{apidoc:src/components/input/Textarea.js}}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
import dash_html_components as html
3+
from dash.dependencies import Input, Output
4+
import dash_bootstrap_components as dbc
5+
6+
colorpicker = dbc.FormGroup(
7+
[
8+
dbc.Label("Choose the text color:", id='label'),
9+
dbc.Input(
10+
type="color",
11+
id="colorpicker",
12+
value="#000000",
13+
style={"width": 75, "height": 50},
14+
),
15+
]
16+
)
17+
18+
19+
@app.callback(
20+
Output("label", "style"), Input("colorpicker", "value"),
21+
)
22+
def update_text(color):
23+
return {"color": color}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)