Gop*_*ala 3 r shiny shinydashboard
我有一个像这样的非常基本的信息框,并且想要调整高度,因为当前高度对于我要合并的内容来说太多了。
知道我该怎么做吗?我尝试了这里的建议:r Shinydashboard - change height of valueBox。但是,这没有任何变化。
sidebar <- dashboardSidebar(
sidebarMenu(id = 'sidebarmenu',
menuItem('About', tabName = 'about'))
)
about <- tabItem('about', fluidPage(
fluidRow(
infoBoxOutput('age')
)
)
)
body <- dashboardBody(
tabItems(
about
)
)
ui <- dashboardPage(
dashboardHeader(
title = 'My App'
),
sidebar = sidebar,
body = body
)
server <- function(input, output) {
output$age <- renderInfoBox({
infoBox('Age: ', 50, icon = icon('list'), width = 6)
})
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
您需要应用一些 CSS 规则。
body <- dashboardBody(
tags$head(tags$style(HTML('.info-box {min-height: 45px;} .info-box-icon {height: 45px; line-height: 45px;} .info-box-content {padding-top: 0px; padding-bottom: 0px;}'))),
tabItems(
about
)
)
Run Code Online (Sandbox Code Playgroud)