Reputation: 401
I want to render a website through 'valueBox' as a hyperlink. Here below is the code:
library(shiny)
library(shinydashboard)
ui = shinyUI(dashboardPage(
dashboardHeader(title = "sam"),
dashboardSidebar( ),
dashboardBody(
fluidRow(
valueBox("100", subtitle = tags$p("Attendance", style = "font-size:
200%;"),
icon = icon("trademark"), color = "yellow", width = 4,
href = "https://economictimes.indiatimes.com/")
) )))
server <- shinyServer(function(input, output) {
})
shinyApp(ui,server)
I don't know how to code for rendering URL through a valueBox() or renderValueBox().
As of now the URL/website is displaying on the existing window. I want the URL/website should be display in a pop-up window.
Can anyone help me on this problem?
Thanks in advance.
Upvotes: 1
Views: 544
Reputation: 4072
Wrap the valueBox
inside an a
tag. In the tag you can set target = "_blank"
to open the link on a new window or tab.
tags$a(
href = "https://economictimes.indiatimes.com/", # Link to open
target = "_blank", # Open in new window
valueBox("100", subtitle = tags$p("Attendance", style = "font-size: 200%;"),
icon = icon("trademark"), color = "yellow", width = 4)
)
Upvotes: 1