The logo for Shiny for Python Shiny for Python
  • Get Started
  • Concepts
  • Components
    • Components
    • Layouts
    • Templates
  • Gallery
  • Playground
  • Reference
    • Shiny Express
    • Shiny Core
    • Testing
  1. UI Inputs
  2. ui.input_action_link
  • Shiny Core API
  • Page containers
    • ui.page_sidebar
    • ui.page_navbar
    • ui.page_sidebar
    • ui.page_fillable
    • ui.page_fluid
    • ui.page_fixed
    • ui.page_bootstrap
    • ui.page_auto
    • ui.page_output
  • UI Layouts
    • ui.sidebar
    • ui.layout_sidebar
    • ui.layout_columns
    • ui.layout_column_wrap
    • ui.card
    • ui.card_header
    • ui.card_footer
    • ui.popover
    • ui.tooltip
    • ui.accordion
    • ui.accordion_panel
    • ui.column
    • ui.row
  • UI Inputs
    • ui.input_select
    • ui.input_selectize
    • ui.input_slider
    • ui.input_dark_mode
    • ui.input_date
    • ui.input_date_range
    • ui.input_checkbox
    • ui.input_checkbox_group
    • ui.input_switch
    • ui.input_radio_buttons
    • ui.input_numeric
    • ui.input_text
    • ui.input_text_area
    • ui.input_password
    • ui.input_action_button
    • ui.input_action_link
    • ui.input_task_button
  • Value boxes
    • ui.value_box
    • ui.value_box_theme
    • ui.showcase_bottom
    • ui.showcase_left_center
    • ui.showcase_top_right
  • Navigation (tab) panels
    • ui.nav_panel
    • ui.nav_spacer
    • ui.nav_menu
    • ui.nav_control
    • ui.navset_bar
    • ui.navset_tab
    • ui.navset_pill
    • ui.navset_underline
    • ui.navset_card_tab
    • ui.navset_card_pill
    • ui.navset_card_underline
    • ui.navset_pill_list
    • ui.navset_hidden
    • ui.navbar_options
  • UI panels
    • ui.panel_absolute
    • ui.panel_fixed
    • ui.panel_conditional
    • ui.panel_title
    • ui.panel_well
  • Uploads & downloads
    • ui.input_file
    • ui.download_button
    • ui.download_link
  • Chat interface
    • ui.Chat
    • ui.chat_ui
  • Streaming markdown
    • ui.MarkdownStream
    • ui.output_markdown_stream
  • Custom UI
    • ui.Theme
    • ui.HTML
    • ui.TagList
    • ui.tags
    • ui.markdown
    • ui.include_css
    • ui.include_js
    • ui.insert_ui
    • ui.remove_ui
    • ui.busy_indicators.use
    • ui.busy_indicators.options
    • ui.fill.as_fillable_container
    • ui.fill.as_fill_item
    • ui.fill.remove_all_fill
    • ui.css.as_css_unit
    • ui.css.as_css_padding
  • Update inputs
    • ui.update_select
    • ui.update_selectize
    • ui.update_slider
    • ui.update_dark_mode
    • ui.update_date
    • ui.update_date_range
    • ui.update_checkbox
    • ui.update_checkbox_group
    • ui.update_switch
    • ui.update_radio_buttons
    • ui.update_numeric
    • ui.update_text
    • ui.update_text_area
    • ui.update_navs
    • ui.update_action_button
    • ui.update_action_link
    • ui.update_task_button
  • Update UI Layouts
    • ui.update_sidebar
    • ui.update_tooltip
    • ui.update_popover
    • ui.update_accordion
    • ui.update_accordion_panel
    • ui.insert_accordion_panel
    • ui.remove_accordion_panel
  • Rendering outputs
    • ui.output_plot
    • ui.output_image
    • ui.output_table
    • ui.output_data_frame
    • ui.output_text
    • ui.output_code
    • ui.output_text_verbatim
    • ui.output_ui
    • render.plot
    • render.image
    • render.table
    • render.text
    • render.code
    • render.ui
    • render.express
    • render.download
    • render.data_frame
    • render.DataGrid
    • render.DataTable
  • Reactive programming
    • reactive.calc
    • reactive.effect
    • reactive.value
    • reactive.Calc
    • reactive.Effect
    • reactive.Value
    • reactive.event
    • reactive.isolate
    • reactive.invalidate_later
    • reactive.extended_task
    • reactive.flush
    • reactive.poll
    • reactive.file_reader
    • reactive.lock
    • req
  • Create and run applications
    • run_app
    • App
    • Inputs
    • Outputs
    • Session
  • Display messages
    • ui.help_text
    • ui.notification_show
    • ui.notification_remove
    • ui.modal
    • ui.modal_show
    • ui.modal_remove
    • ui.modal_button
    • ui.Progress
  • Modules
    • module.ui
    • module.server
  • Developer facing tools
    • Session
    • Create output renderers
    • htmltools methods
    • ExtendedTask
  • Types
    • Miscellaneous types
    • Tag types
    • Exception types
  • Deprecated
    • render.transformer.output_transformer
    • render.transformer.resolve_value_fn
  • Experimental
    • Card

On this page

  • ui.input_action_link
    • Parameters
    • Returns
    • Notes
    • See Also
    • Examples
  • Report an issue
  • Edit this page
  1. UI Inputs
  2. ui.input_action_link

ui.input_action_link

ui.input_action_link(id, label, *, icon=None, **kwargs)

Creates a link whose value is initially zero, and increments by one each time it is pressed.

Parameters

id : str

An input id.

label : TagChild

An input label.

icon : TagChild = None

An icon to appear inline with the button/link.

****kwargs** : TagAttrValue = {}

Attributes to be applied to the link.

Returns

: Tag

A UI element

Notes

Server value

An integer representing the number of clicks.

See Also

  • update_action_link
  • input_action_button
  • event

Examples

#| '!! shinylive warning !!': |
#|   shinylive does not work in self-contained HTML documents.
#|   Please set `embed-resources: false` in your metadata.
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

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

from shiny import App, Inputs, Outputs, Session, reactive, render, ui

app_ui = ui.page_fluid(
    ui.input_slider("n", "Number of observations", min=0, max=1000, value=500),
    ui.input_action_link("go", "Go!"),
    ui.output_plot("plot"),
)


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


app = App(app_ui, server)

ui.input_action_button
ui.input_task_button

Proudly supported by Posit

 
  • Report an issue
  • Edit this page