0

this question is a follow-up of previous post Create URL hyperlink in R Shiny? .

I'm using the solution shared there, namely:

runApp(
  list(ui = fluidPage(
     uiOutput("tab")
    ),
  server = function(input, output, session){
    url <- a("Google Homepage", href="https://www.google.com/")
    output$tab <- renderUI({
      tagList("URL link:", url)
    })
  })
)

The solution above works fine. However, I would need to:

  • customize the font size and color
  • make sure the link opens up a new page in a new browser tab. I can't find a way to achieve these two goals and I'm not familiar with HTML. Any help would be much appreciated. Thanks
Angelo
  • 1,594
  • 5
  • 17
  • 50

1 Answers1

2

Use style to change font size and color and target="_blank" to open the link in new tab.

library(shiny)

runApp(
  list(ui = fluidPage(
    uiOutput("tab")
  ),
  server = function(input, output, session){
    url <- a("Google Homepage", href="https://www.google.com/", 
             style = "color:orange;font-size:18px", target="_blank")
    output$tab <- renderUI({
      tagList("URL link:", url)
    })
  })
)
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213