在闪亮的仪表板中的dashboardHeader中调整整个标题栏的高度

B.C*_*B.C 1 shiny shinydashboard

我看到这里有一个类似的问题:

调整shinydashboard中仪表板的高度

但我没有对给定答案发表评论的声誉.

给出这个答案的解决方案适用于我想扩展标题大小的情况.但是当我将大小减小到20像素时,这只会改变标题标题部分的高度,我想减少闪亮仪表板中整个标题栏的高度.这可能吗 ?

以下是使用所提问题的解决方案的示例:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(
    # Set height of dashboardHeader
    tags$li(class = "dropdown",
            tags$style(".main-header {max-height: 20px}"),
            tags$style(".main-header .logo {height: 20px}")
    ) 
  ),
   dashboardSidebar(
    # Adjust the sidebar
    tags$style(".left-side, .main-sidebar {padding-top: 20px}")
  ),
  dashboardBody()
)

server <- function(input, output){}

shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)

小智 5

您需要覆盖导航栏的最小高度和侧边栏切换上的填充.我已在下面更新了您的示例:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(
    # Set height of dashboardHeader
    tags$li(class = "dropdown",
            tags$style(".main-header {max-height: 20px}"),
            tags$style(".main-header .logo {height: 20px;}"),
            tags$style(".sidebar-toggle {height: 20px; padding-top: 1px !important;}"),
            tags$style(".navbar {min-height:20px !important}")
    ) 
  ),
   dashboardSidebar(
    # Adjust the sidebar
    tags$style(".left-side, .main-sidebar {padding-top: 20px}")
  ),
  dashboardBody()
)

server <- function(input, output){}

shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)