An example of a default LED display without any extra properties.
from dash import Dash, html, dcc, Input, Output, callback
import dash_daq as daq
app = Dash()
app.layout = html.Div([
daq.LEDDisplay(
id='my-LED-display-1',
label="Default",
value=6
),
dcc.Slider(
id='my-LED-display-slider-1',
min=0,
max=10,
step=1,
value=5
),
])
@callback(
Output('my-LED-display-1', 'value'),
Input('my-LED-display-slider-1', 'value')
)
def update_output(value):
return str(value)
if __name__ == '__main__':
app.run(debug=True)
Set the label and label position with label
and labelPosition
.
import dash_daq as daq
daq.LEDDisplay(
label="Label",
labelPosition='bottom',
value='12:34'
)
Adjust the size of the LED display with size
.
import dash_daq as daq
daq.LEDDisplay(
label="Large",
value="9:34",
size=64,
)
Adjust the color of the LED display with color=#<hex_color>
.
import dash_daq as daq
daq.LEDDisplay(
label="color",
value='1.001',
color="#FF5E5E"
)
Adjust the background color of the LED display using:
backgroundColor=#<hex_color>
import dash_daq as daq
daq.LEDDisplay(
label="color",
value='1.001',
backgroundColor="#FF5E5E"
)
Access this documentation in your Python terminal with:
```pythonhelp(dash_daq.LEDDisplay)
```
Our recommended IDE for writing Dash apps is Dash Enterprise’s
Data Science Workspaces,
which has typeahead support for Dash Component Properties.
Find out if your company is using
Dash Enterprise.
id
(string; optional):
The ID used to identify the display in Dash callbacks.
value
(number | string; optional):
Value to be displayed. A number or a string containing only digits
(0-9), periods, and colons, and possibly starting with a minus sign.
color
(string; default colors.PRIMARY
):
Color of the display.
backgroundColor
(string; default '#fff'
):
Color of the display’s background.
size
(number; default 42
):
Size of the display.
theme
(dict; default light
):
Theme configuration to be set by a ThemeProvider.
label
(dict; optional):
Description to be displayed alongside the control. To control styling,
pass an object with label and style properties.
label
is a string | dict with keys:
label
(string; optional)
style
(dict; optional)
labelPosition
(a value equal to: ‘top’ or ‘bottom’; default 'top'
):
Where the display label is positioned.
className
(string; optional):
Class to apply to the root component element.
style
(dict; optional):
Style to apply to the root component element.