Skip to content

[Bug]: update_action_button() has no effect on download button #1994

@nvelden

Description

@nvelden

Component

UI (ui.*)

Severity

P3 - Low (minor inconvenience)

Shiny Version

1.4.0

Python Version

3.13.2

Minimal Reproducible Example

from shiny.express import input, render, ui
from shiny import reactive
import pandas as pd

# UI
ui.input_file(
    "csv_file",
    "Upload CSV file:",
    multiple=False,
    accept=".csv"
)

@render.download(filename="download.csv")
def download_csv():
    file = input.csv_file()
    if not file:
        yield "No CSV file uploaded."
        return

    # Read uploaded file
    df = pd.read_csv(file[0]["datapath"])

    # Yield the CSV content as a string
    yield df.to_csv(index=False)



@reactive.effect
def _():
    ui.update_action_button("download_csv", disabled=not input.csv_file())

Behavior

I am building a shiny.express app where users can upload a file, make some modifications, and then download the result. I’d like the download button to be disabled by default and only become enabled after a file has been uploaded.

However, using update_action_button() to control the button’s state doesn’t seem to have any effect.

Do I miss something or is there an alternative method I should use?

Error Messages (if any)

Environment

MacOS Sequuoia 15.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions