Stop Button Examples and Reference


Default Stop Button

An example of a default stop button without any extra properties.

library(dash)
library(dashDaq)
library(dashHtmlComponents)

app <- Dash$new()

app$layout(htmlDiv(list(
  daqStopButton(
    id = 'my-stop-button',
    label = 'Default',
    n_clicks = 0
  ),
  htmlDiv(id = 'stop-button-output')
)))

app$callback(
  output(id = "stop-button-output", property = "children"),
  params = list(input(id = "my-stop-button", property = "n_clicks")),

  update_output <- function(n_clicks) {
    return(sprintf("The stop button has been clicked %s times.", n_clicks))
  }
)

app$run_server()

Label

Set the label and label position with label and labelPosition.

library(dashDaq)

daqStopButton(
    label = "Label",
    labelPosition = "top"
)

Size

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

library(dashDaq)

daqStopButton(
    size = 120
)

Button Text

Set the text displayed in the button buttonText.

library(dashDaq)

daqStopButton(
    buttonText = "text"
)

Disabled

Disable the button by setting disabled=TRUE.

library(dashDaq)

daqStopButton(
    disabled = TRUE
)

StopButton Properties

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 (unnamed list of or a singular dash component, character or numeric; optional):
The children of the button.

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

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

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

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

disabled (logical; optional):
If TRUE, button cannot be pressesd.

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

label (named list; optional):
Description to be displayed alongside the button. To control styling,
pass an object with label and style properties.

label is a character | named list with keys:

  • label (character; optional)

  • style (named list; optional)

labelPosition (a value equal to: ‘top’ or ‘bottom’; default 'top'):
Where the label is positioned.

className (character; optional):
Class to apply to the root component element.

style (named list; optional):
Style to apply to the root component element.