【问题标题】:center header in shiny dashboard boxes闪亮仪表板框中的中心标题
【发布时间】:2021-05-19 09:03:34
【问题描述】:

我正在为应用程序使用闪亮的仪表板,但找不到将标题居中的方法:

box(title = "Labels"
, status = "primary", solidHeader = T...

“标签标题位于框的左角,希望它位于中心,有什么想法吗?

【问题讨论】:

  • 试试title = h1("Labels", align = "center")
  • 所以不知何故 h1:h6 确实居中,但标题框的大小很大,知道如何调整它的大小吗?

标签: r shiny shinydashboard


【解决方案1】:

为您提供一些选择...

library(shiny)
library(shinydashboard)

ui <- shinyUI(dashboardPage(

  dashboardHeader(title = "Test App"),

  dashboardSidebar(

    selectInput("dt","Data", choices = list("cars","mtcars","pressure")  )

  ),

  ## BODY

  dashboardBody(
    fluidRow(
      column(
        width = 10, 

        box(title = h1("My Title with h1 ", align="center"),
            solidHeader = T,
            width = 5, height = 500,
            collapsible = T,
            plotOutput("plot1", height=350)
            ),
        box(title = h6("My Title with h6 ", align="center"),
            solidHeader = T,
            width = 5, height = 500,
            collapsible = T,
            plotOutput("plot2")
        ))), br(), br(),
    fluidRow(
      column(width = 8, align="center",
             box(title = div("My Title with div, red color and font-size 22 ", style='color:red; font-size:22px;'),
                 solidHeader = T,
                 width = 8, height = 500,
                 collapsible = T,
                 plotOutput("plot3")
             ) )
    )
      
  
  )))

server <- shinyServer(function(input, output) {
  
  output$plot1 <- renderPlot({
    req(input$dt)
    plot(get(input$dt))
  })

  output$plot2 <- renderPlot({plot(mtcars)})

  output$plot3 <- renderPlot({plot(pressure)})
})

shinyApp(ui = ui, server = server)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 2017-05-21
    • 2021-09-05
    相关资源
    最近更新 更多