Search code examples
htmlcssrshinytags

How to adjust the font of an URL in an R shiny app?


I have used the following code to create an URL in my shiny App to open google on clicking the link

output$Reverse<- renderUI({
   tags$a(href="www.google.com", "Search") })

How do I change the font size and color of the word search in the App.

I request someone to help me here.


Solution

  • Just add a style argument to the a-tag using css:

    library(shiny)
    
    ui <- fluidPage(
      uiOutput("Reverse")
    )
    
    server <- function(input, output, session) {
      output$Reverse<- renderUI({
        tags$a(href="http://www.google.com", "Search", style = "font-size: 200px; color: red;")
        })
    }
    
    shinyApp(ui, server)