简体   繁体   English

以切换按钮位于仪表板最左侧的方式隐藏 shiny 仪表板的标题部分 header

[英]Hide title section of shiny dashboard in a way that the toggle button is in the most left spot of the dashboard header

I would like to know how can I totally skip the title section from shinydashboard header. So the first object to see will be the toggle button that hides and display the sidebar.我想知道如何才能完全跳过 shinydashboard header 的标题部分。所以第一个看到的 object 将是隐藏和显示侧边栏的切换按钮。 Now if I set titlewidth to 0 there is still a small gap between the toggle button and the beginning of the page.现在,如果我将titlewidth设置为 0,切换按钮和页面开头之间仍然有一个小间隙。 Something like:就像是:

在此处输入图像描述

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(
  titleWidth = 0
  ),
  dashboardSidebar(
  ),
  dashboardBody(
    )
)

server <- function(input, output){}

shinyApp(ui, server)

Would adding this bit of CSS help?添加这一点 CSS 会有帮助吗?

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
 
  dashboardHeader(
    titleWidth = 0
  
  ),
  dashboardSidebar(
  ),
  dashboardBody(
    tags$style(type="text/css",".sidebar-toggle{ position: absolute;
    left: 0;
}")
  
  )
)

server <- function(input, output){}

shinyApp(ui, server)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM