Editing an actionLink in shiny

Hello everyone,

I have a problem to editing an actionLink in a shiny app under some conditions.
For example, if a condition is true, the label of actionLink must be, for example, "hello"; under another condition the label must be "hello2".
I really don't know how to fix this.
Thank you very much,
Alex

Use uiOutput()/renderOutput()

it's not so easy.
in the UI page i have this part of code:
column(1,align="center",
actionLink("Home","HOME",style="color: white; display: block;padding-top: 20px;}")
).
When a condition is active the label of actionLink must be became "HOME2" and not "HOME".
viceversa with the other condition

library(shiny)

library(shinythemes)

ui <- fluidPage(theme = shinythemes::shinytheme("cyborg"),
 shiny::checkboxInput("check1","Toggle a condition"),
 uiOutput("myout")
)

server <- function(input, output, session) {
  
  output$myout <- renderUI({
    h_label <- "HOME2"
    if(isTruthy(input$check1))
      h_label <- "HOME"
    
    actionLink(inputId = "Home",label = h_label,
               style="color: white; display: block;padding-top: 20px;}")
  })
}

shinyApp(ui, server)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.