Created
November 23, 2021 14:22
-
-
Save jrosell/725b3ae3fc1ccaa24ce0a92c466c42c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
ui <- fluidPage( | |
titlePanel("Shiny updateInput"), | |
actionButton( | |
"input_update", | |
label = "Utilitzo updateInput", | |
icon = icon("arrow-up") | |
), | |
actionButton( | |
"click_button", | |
label = "Actualitzo valor" | |
) | |
) | |
server <- function(input, output, session) { | |
observeEvent(input$click_button, { | |
clicks <- input$click_button | |
icon_status_up <- | |
is.null(clicks) || clicks %% 2 == 0 | |
icon_name <- if(icon_status_up) { | |
"arrow-up" | |
} else { | |
"arrow-down" | |
} | |
updateActionButton( | |
session, | |
"input_update", | |
icon = icon(icon_name) | |
) | |
}) | |
} | |
shinyApp(ui, server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment