【问题标题】:R shinydashboardPlus - make the pretty switch pretty againR shinydashboardPlus - 让漂亮的开关再次漂亮
【发布时间】:2020-08-13 03:11:00
【问题描述】:

在右侧边栏中使用 shinydashboardPlus 和 prettySwitch - 开关元素的对齐方式混乱

有没有办法让开关像这样重新变漂亮

这里是代码。设置 md = FALSE 会起作用,但会影响其他一切的外观,所以我不想这样做。

library(shinydashboardPlus)
library(shinyWidgets)

ui <- dashboardPagePlus(
  dashboardHeaderPlus(
    enable_rightsidebar = TRUE
  )
  , dashboardSidebar()
  , dashboardBody()
  , rightSidebar(
    background = "light"
    , rightSidebarTabContent(
      id = "id"
      , title = "title"
      , prettySwitch(
        inputId = "switch_id"
        , label = "switch"
      )
    )
  )
  , md = TRUE
)

server <- function(input, output){}

shinyApp(ui, server)

【问题讨论】:

  • 您好,我在shinydashboardPlus 中找不到dashboardSidebar(),它是从哪里来的?
  • 来自shinydashboard

标签: r shiny shinydashboard shinywidgets


【解决方案1】:

与 Material Design 主题存在 CSS 冲突,要修复它,您可以将以下 CSS 代码添加到您的应用程序中:

  , tags$style(HTML(
    ".pretty > div > label {font-size: 14px !important; line-height: 1px !important;}"
  ))

以上prettySwitch为例

【讨论】:

    【解决方案2】:

    虽然不是优雅的方式,但你可以通过修改CSS来调整它

    【讨论】:

    • 这是一个好的开始——你也能把球打进椭圆形吗?
    猜你喜欢
    • 2020-11-21
    • 2014-07-17
    • 2021-06-22
    • 2018-06-20
    • 2021-08-14
    • 1970-01-01
    • 2016-11-30
    • 2021-03-06
    • 2014-02-20
    相关资源
    最近更新 更多