R ShinydashboardPlus-使漂亮的开关再次变得漂亮

问题描述 投票:0回答:2

使用带有右侧面板的prettySwitch的ShinydashboardPlus-开关元素的排列混乱了

ugly switch

是否有办法像这样使开关再次漂亮

pretty switch

这里是代码。设置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)
r shiny shinydashboard shinywidgets
2个回答
0
投票

即使不是很优雅的方法,也可以通过修改CSS进行调整

enter image description here


0
投票

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

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

例如prettySwitch以上

© www.soinside.com 2019 - 2024. All rights reserved.