内容变量中的bs_embed_popover HTML标签

时间:2019-01-29 15:59:00

标签: html r shiny popover

我正在尝试将指向R闪亮应用程序的content函数的bs_embed_popover变量中的URL链接 Documentation

  

content:字符,弹出框正文的内容,可以是HTML

但是,我看到标签在闪亮的应用程序中显示为普通字符 我有什么想念的吗? enter image description here

library(shiny)
library(bsplus)
library(htmltools)
library(shinydashboard)

# UI
ui <-   
  dashboardPage(
    dashboardHeader(title = "Titles"),
    dashboardSidebar(
      use_bs_popover(),
      selectInput(
        inputId = "letter",
        label = "Label with popover help",
        choices = c("a", "b", "c")
      ) %>%
        shinyInput_label_embed(
          shiny_iconlink() %>%
            bs_embed_popover(
              title = "Letter", content = paste0("Choose a favorite","<a href='www.google.com'>  Test link </a>")
              , placement ="right"
            )
        )
    ),
    dashboardBody(
      tags$style(HTML('.popover-title {color:black;}
                      .popover-content {color:black;}
                      .main-sidebar {z-index:1;}')
    )

  ))

# Server
server <- shinyServer(function(input, output) {    
})

# Run the applicationenter image description here
shinyApp(ui = ui, server = server)

1 个答案:

答案 0 :(得分:2)

您可以在html="true"指令之后添加指令content=HTML(paste0(....,如下所示:

bs_embed_popover(
              title="Letter"
              , content=paste0("Choose a favorite","<a href='www.google.com'>  Test link </a>")
              , placement="right"
              , html="true"
            )