通过valueBox()或renderValueBox()呈现URL

时间:2019-04-15 06:28:01

标签: shiny shinydashboard

我想通过“ valueBox”将网站呈现为超链接。下面是代码:

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)

我不知道如何通过valueBox()或renderValueBox()呈现URL的代码。

到目前为止,URL /网站已显示在现有窗口中。我希望该URL /网站应显示在弹出窗口中。

有人可以帮助我解决这个问题吗?

谢谢。

1 个答案:

答案 0 :(得分:0)

valueBox包裹在a标记内。在标签中,您可以设置target = "_blank"在新窗口或标签上打开链接。

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)
)