如何使渐变框在有光泽的情况下可关闭



现在盒子最初是打开的,而不是我需要的,盒子应该关闭。在我点击可折叠的之前,盒子不应该打开

library(shiny)
library(shinydashboard)
shinyApp(
ui = dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
gradientBox(
title = "My gradient Box",
icon = "fa fa-th",
gradientColor = "teal", 
boxToolSize = "sm", 
footer = sliderInput(
"obs", 
"Number of observations:",
min = 0, max = 1000, value = 500
),
"This is a gradient box"
)
),
title = "Description Blocks"
),
server = function(input, output) { }
)

gradientBox中似乎没有一个参数可以在启动时折叠盒子。

由于{shinydashboardPlus}2.0.0版本的gradientBox已被删除,因此可以使用box。这有一个参数collapsed,当为true时将开始折叠:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
ui <- dashboardPage( 
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
box(
"This is a gradient box",
title = "My gradient Box",
gradient = TRUE,
background = "teal",
collapsible = TRUE,
collapsed = TRUE,
boxToolSize = "sm",
footer = sliderInput(
"obs", 
"Number of observations:",
min = 0, 
max = 1000, 
value = 500
)
)
),
title = "Description Blocks"
)
shinyApp(
ui = ui,
server = function(input, output) { }
)

如果无法升级{shinydashboardPlus},则可以使用boxPlus。它将无法使用渐变,但仍然可以开始塌陷。

最新更新