首页 > 解决方案 > shinyapp 在 ui 中加粗

问题描述

我想在句子的 UI 中加几个粗体字。我不确定HTML 标签h(). 任何帮助将不胜感激。提前谢谢了。

library(shiny)
    ui <- navbarPage(
      title = 'Benvenuto',
      tabPanel('read.me', icon = icon("book-open"),  column(4,
                                                            
                                                            h3("Welcome to Interactive User Interface"),
                                                            
                                                            tags$b("Please wait/refresh.", style="color:red"),
    
                                                            h3("Table"),
                                                            h4("Pivot table."),
                                                            
                                                            h2("I HAVE A LONG SENTENCE HERE AND I WANT A FEW WORDS TO BE BOLD ONLY."),
                                                        
      )), 
    
      tabPanel('Table', icon = icon("table"), rpivotTableOutput("pivot") ),
      id="navbar" )
    
    server <- function(input, output) {
    
      output$pivot <- renderRpivotTable({
        rpivotTable(data =   mtcars,  
                    rows = "cyl",
                    cols = c("am", "gear", "carb"),
                    #vals = "Freq", aggregatorName = "Count", rendererName = "Table", subtotals = TRUE) # use this or below line
                    #aggregatorName = "Sum as Fraction of Columns", vals = "Freq", rendererName = "Table Barchart")
                    aggregatorName = "Sum as Fraction of Rows", vals = "cyl", rendererName = "Table With Subtotal")
        #width="200%", height="600px")
        
      })
    
    }
    shinyApp(ui, server)

预期的答案,我这里有一个很长的句子,我想要几个粗体

标签: htmlrshiny

解决方案


您可以使用该HTML功能只使用这样的标签:

HTML("<h2>I HAVE A LONG SENTENCE HERE AND I WANT <b>A FEW WORDS</b> TO BE BOLD ONLY.</h2>")


推荐阅读