Stop Button Examples and Reference


Default Stop Button

An example of a default stop button 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.StopButton(
        id='my-stop-button-1',
        label='Default',
        n_clicks=0
    ),
    html.Div(id='stop-button-output-1')
])

@callback(
    Output('stop-button-output-1', 'children'),
    Input('my-stop-button-1', 'n_clicks')
)
def update_output(n_clicks):
    return f'The stop button has been clicked {n_clicks} times.'

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

Label

Set the label and label position with label and labelPosition.

import dash_daq as daq

daq.StopButton(
    label='Label',
    labelPosition='top'
)

Size

Adjust the size (width in pixels) of the stop button with size.

import dash_daq as daq

daq.StopButton(
    size=120,
)

Button Text

Set the text displayed in the button buttonText.

import dash_daq as daq

daq.StopButton(
    buttonText='text',
)

Disabled

Disable the button by setting disabled=True.

import dash_daq as daq

daq.StopButton(
    disabled=True,
)

StopButton Properties

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

help(dash_daq.StopButton)
```

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
.

children (list of or a singular dash component, string or number; optional):
The children of the button.

id (string; optional):
The ID used to identify this compnent in Dash callbacks.

size (number; default 92):
The size (width) of the stop button in pixels.

buttonText (string; default 'Stop'):
Text displayed in the button.

n_clicks (number; default 0):
Number of times the button was clicked.

disabled (boolean; optional):
If True, button cannot be pressesd.

theme (dict; optional):
Theme configuration to be set by a ThemeProvider.

label (dict; optional):
Description to be displayed alongside the button. 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 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.