Indicator Examples and Reference


Default Indicator

An example of a default Indicator without any extra properties.

from dash import Dash, html, Input, Output, callback
import dash_daq as daq

app = Dash(__name__)

app.layout = html.Div([
    daq.Indicator(
        id='my-indicator-1',
        label="Default",
    ),
    html.Button(
        'On/Off',
        id='my-indicator-button-1',
        n_clicks=0
    ),
])

@callback(
    Output('my-indicator-1', 'value'),
    Input('my-indicator-button-1', 'n_clicks')
)
def update_output(value):
    return True if value % 2 == 0 else False

if __name__ == '__main__':
    app.run(debug=True)

Label

Define the label and label orientation with label and labelPosition.

import dash_daq as daq

daq.Indicator(
  label="Label",
  labelPosition="bottom",
  value=True
)

Boolean Indicator Off

A boolean indicator set to off value=False.

import dash_daq as daq

daq.Indicator(
  label="Off",
  value=False
)

Square

Create a square boolean indicator by setting the width and height to the same value.

import dash_daq as daq

daq.Indicator(
  label="Square",
  width=16,
  height=16
)

Color

Define the color of the boolean indicator with color='#<color>'

import dash_daq as daq

daq.Indicator(
  label="Purple",
  color="#551A8B",
  value=True
)

Indicator Properties

Access this documentation in your Python terminal with:
```python

help(dash_daq.Indicator)
```

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 indicator in Dash callbacks.

value (boolean; optional):
If True, indicator is illuminated.

color (string; default colors.DARKER_PRIMARY):
Color of the indicator.

size (number; default 15):
Size of the component. Either use this or width and height.

width (number; optional):
Width of the component. Set both width and height for a rectangular
indicator.

height (number; optional):
Height of the component. Set both width and height for a rectangular
indicator.

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’, ‘bottom’, ‘right’ or ‘left’; default 'top'):
Where the indicator 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.