我在R(RRO 8.0.3 CRAN-R 3.1.3)中使用闪亮(0.12.0)和shinydashboard(0.4.0 )来创建UI,我喜欢我所看到的.但是,我希望能够控制项目的宽度,因为我需要在那里放置一些宽的选择器框.dashboardSidebar
ui <- dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar(#stuffhere) #would like a width param setting
dashboardBody()
)
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点(一些隐藏的宽度参数,或嵌入式CSS)或者我是否必须回到无聊的闪亮并从头开始构建它?

she*_*heß 12
旧的答案可能仍然有效,但现在还有一个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) { }
)
Run Code Online (Sandbox Code Playgroud)
侧栏的宽度由.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()
)
Run Code Online (Sandbox Code Playgroud)