在右侧边栏中结合使用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)发布于 2020-04-29 15:49:34
即使不是很优雅的方式,但您可以通过修改CSS来调整它

发布于 2020-04-29 16:32:10
CSS与Material Design主题存在冲突,要解决此问题,可以将以下CSS代码添加到您的应用程序中:
, tags$style(HTML(
".pretty > div > label {font-size: 14px !important; line-height: 1px !important;}"
))例如,在prettySwitch之上
https://stackoverflow.com/questions/61494873
复制相似问题