如何使渐变框在闪亮中可关闭
How to make a gradient box closable in shiny
现在盒子最初是打开的,而不是我需要的盒子应该是关闭的。
在我点击可折叠按钮之前,盒子不会打开
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
。它将无法使用渐变,但仍然可以开始折叠。
现在盒子最初是打开的,而不是我需要的盒子应该是关闭的。 在我点击可折叠按钮之前,盒子不会打开
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
。它将无法使用渐变,但仍然可以开始折叠。