Experimental.
Observes a compatible Shiny shiny::ExtendedTask status function and maps
its lifecycle to update_shad_button(). The task remains application-owned;
this helper does not invoke the task, inspect its result, or create an async
backend.
Usage
bind_shad_task_button(
task,
id,
label_busy = "Processing...",
label_success = NULL,
label_error = NULL,
session = shiny::getDefaultReactiveDomain()
)See also
Other shadshiny server API:
shad_message_scroller_to_bottom(),
shad_overlay_server,
shad_remove_dialog(),
shad_show_dialog(),
shad_toast(),
update_shad,
update_shad_command()
Examples
if (interactive()) {
ui <- page_shad(
shad_button("Run report", inputId = "run"),
shad_button("Finish", inputId = "finish", variant = "outline")
)
server <- function(input, output, session) {
# Usually a shiny::ExtendedTask; any object with a $status() works.
state <- shiny::reactiveVal("initial")
task <- list(status = function() state())
bind_shad_task_button(task, "run", label_success = "Done")
shiny::observeEvent(input$run, state("running"))
shiny::observeEvent(input$finish, state("success"))
}
shiny::shinyApp(ui, server)
}