我使用闪亮的 (0.12.0)和闪光仪表板 (0.4.0)在R (RRO 8.0.3cran-R3.1.3)中创建UI,我喜欢我看到的内容。但是,我希望能够控制dashboardSidebar项的宽度,因为我需要在其中放置一些宽的选择器框。
ui <- dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar(#stuffhere) #would like a width param setting
dashboardBody()
)有没有办法做到这一点(一些良好隐藏的宽度参数,或嵌入css),还是我必须回到无聊的光泽,并从地面上构建它呢?

发布于 2021-02-17 12:54:40
旧的答案可能仍然有效,但现在也有一个width = ...选项。见:https://rstudio.github.io/shinydashboard/appearance.html#sidebar-width。下面是这里显示的示例代码:
shinyApp(
ui = dashboardPage(
dashboardHeader(
title = "Title and sidebar 350 pixels wide",
titleWidth = 350
),
dashboardSidebar(
width = 350,
sidebarMenu(
menuItem("Menu Item")
)
),
dashboardBody()
),
server = function(input, output) { }
)发布于 2015-05-21 14:41:51
侧栏的宽度由.left-side类上的CSS设置,因此您可以这样做:
dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar( tags$style(HTML("
.main-sidebar{
width: 300px;
}
")),selectInput("id","Select a survey",choices=c("Very very very very long text","text"))),
dashboardBody()
)https://stackoverflow.com/questions/30351560
复制相似问题