express.ui.input_action_button(id, label, *, icon=None, width=None, **kwargs)

Creates an action button whose value is initially zero, and increments by one each time it is pressed.


id: str

An input id.

label: TagChild

An input label.

icon: TagChild = None

An icon to appear inline with the button/link.

width: Optional[str] = None

The CSS width, e.g. ‘400px’, or ‘100%’

**kwargs: TagAttrValue = {}

Attributes to be applied to the button.


Type Description
Tag A UI element


Server value

An integer representing the number of clicks.

See Also


#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file:
import matplotlib.pyplot as plt
import numpy as np

from shiny import reactive, render
from import input, ui

ui.input_slider("n", "Number of observations", min=0, max=1000, value=500)
ui.input_action_button("go", "Go!", class_="btn-success")

@render.plot(alt="A histogram")
# Use reactive.event() to invalidate the plot only when the button is pressed
# (not when the slider is changed)
@reactive.event(input.go, ignore_none=False)
def plot():
    x = 100 + 15 * np.random.randn(input.n())
    fig, ax = plt.subplots()
    ax.hist(x, bins=30, density=True)
    return fig