【问题标题】:Shinydahsboardplus: how to add box without a title?Shinydashboardplus:如何添加没有标题的框?
【发布时间】:2021-03-18 10:10:06
【问题描述】:

在最近更新 ShinydasboardPlus(到 2.0)之后,我无法制作没有标题且没有标题空间的 box

我试过title = NULL, headerBorder = FALSE 仍然有这个空间。如何摆脱它?我想要一个只有内容的盒子,没有标题,没有标题空间。

谢谢!

例子:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
ui <- dashboardPage(
  title = "Box API",
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    box(
      title = NULL,
      headerBorder = FALSE,
      "Box body")
  )
)

server <- function(input, output, session) {
}

shinyApp(ui, server)

【问题讨论】:

  • 当然!对此感到抱歉。

标签: r shiny shinydashboard shinydashboardplus


【解决方案1】:

您可以使用css 不显示标题。像这样的:

ui <- dashboardPage(
  title = "Box API",
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    box(
      id = 'foo',  # use an id to only select this box
      title = NULL,
      headerBorder = FALSE,
      "Box body"
    ),
    tags$head(tags$style('#foo .box-header{ display: none}'))  # target the box header of foo
  )
)

【讨论】:

    猜你喜欢
    • 2021-12-17
    • 1970-01-01
    • 2021-09-17
    • 1970-01-01
    • 1970-01-01
    • 2020-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多