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. Update inputs
  2. ui.update_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.update_action_link
    • Parameters
    • Note
    • See Also
    • Examples
  • Report an issue
  • Edit this page
  1. Update inputs
  2. ui.update_action_link

ui.update_action_link

ui.update_action_link(id, *, label=None, icon=None, session=None)

Change the label and/or icon of an action link on the client.

Parameters

id : str

An input id.

label : Optional[str] = None

An input label.

icon : TagChild = None

An icon to appear inline with the button/link.

session : Optional[Session] = None

A Session instance. If not provided, it is inferred via get_current_session.

Note

The input updater functions send a message to the client, telling it to change the settings of an input object. The messages are collected and sent after all the observers (including outputs) have finished running.

The syntax of these functions is similar to the functions that created the inputs in the first place. For example, input_numeric and update_numeric take a similar set of arguments.

Any arguments with None values will be ignored; they will not result in any changes to the input object on the client.

For update_radio_buttons, update_checkbox_group, and update_select, the set of choices can be cleared by using choices=[]. Similarly, for these inputs, the selected item can be cleared by using selected=[].

See Also

  • input_action_link

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
from shiny import App, Inputs, Outputs, Session, reactive, req, ui

app_ui = ui.page_fluid(
    ui.input_action_button("update", "Update other buttons and link"),
    ui.br(),
    ui.input_action_button("goButton", "Go"),
    ui.br(),
    ui.input_action_button("goButton2", "Go 2", icon="🤩"),
    ui.br(),
    ui.input_action_button("goButton3", "Go 3"),
    ui.br(),
    ui.input_action_link("goLink", "Go Link"),
)


def server(input: Inputs, output: Outputs, session: Session):
    @reactive.effect
    def _():
        req(input.update())
        # Updates goButton's label and icon
        ui.update_action_button("goButton", label="New label", icon="📅")
        # Leaves goButton2's label unchanged and removes its icon
        ui.update_action_button("goButton2", icon=[])
        # Leaves goButton3's icon, if it exists, unchanged and changes its label
        ui.update_action_button("goButton3", label="New label 3")
        # Updates goLink's label and icon
        ui.update_action_link("goLink", label="New link label", icon="🔗")


app = App(app_ui, server)

ui.update_action_button
ui.update_task_button

Proudly supported by Posit

 
  • Report an issue
  • Edit this page