【发布时间】:2021-10-27 20:22:15
【问题描述】:
我设法在闪亮的仪表板标题中放置了一个操作按钮。但是,当使用tags$li 应用样式时,它仅适用于侧边栏。删除 tags$a 部分时,样式将应用于整个标题。不知道如何修复它,所以整个标题的样式是一致的——希望在堆栈溢出中得到一些提示/方向。
我看过这些帖子:
这个问题是我之前问题的延伸:resizing an action button causes misalignment in the header in shinydashboard
这是一个reprex(下图):
library(shiny)
library(shinydashboard)
library(htmltools)
library(shinyjs)
ui <- dashboardPage(
dashboardHeader(
tags$li(class = "dropdown",
tags$a(actionButton(inputId = "email1", label = "",
icon = icon("envelope", lib = "font-awesome")
#Also tried to adjust the width and height of transparent, no luck
# ,
# style='height: 20px;
# background: transparent;
# border: none;
# font-size: 2rem;
# transform: translate(5%, -30%);'
),
href="mailto:have_a_nice_day@yep.com;"),
# has no effect on the main header bar (the header in which button is placed)
tags$style(".main-header {max-height: 20px}"),
tags$style(".main-header .logo {height: 20px;}"),
tags$style(".sidebar-toggle {height: 20px; padding-top: 1px !important;}"),
tags$style(".navbar {min-height:20px !important}")
)
),
dashboardSidebar(
),
dashboardBody()
)
server <- function(input, output){}
shinyApp(ui, server)
非常感谢您的帮助!
【问题讨论】:
标签: r shiny shinydashboard shinyjs htmltools