0

我在闪亮仪表板的标题上放置了一个操作按钮,它会自动打开默认邮件应用程序并填充 To: 行。但是,当我调整按钮大小时,可折叠侧边栏标题和主标题会错位(请参阅下图以获取参考)。

此外,我在 SO 中查看了这些帖子:

  1. 在仪表板标题中间对齐具有可变长度的文本
  2. 在闪亮的仪表板中对齐标题元素

但是,关注他们并没有为我的问题提供足够的帮助。这是代表:

library(shiny)
library(shinydashboard)
library(shinyjs)
library(shinydashboardPlus)
library(htmltools)
library(DT)


ui <- shinydashboardPlus::dashboardPage(
  options = list(sidebarExpandOnHover = TRUE),
  header = shinydashboardPlus::dashboardHeader(disable = FALSE,
                                               tags$li(class = "dropdown",
                                                       
                                                       
                                                       tags$a(actionButton(inputId = "email1", label = "",
                                                                           icon = icon("envelope", lib = "font-awesome")
                                                                           ,
                                                                           style='height: 20px; width: 30px;
                                                                        margin-top: 0px; margin-right: 0px;
                                                                        margin-bottom: 0px; padding:4px 4px 20px 4px;'
                                                       ),
                                                       href="mailto:my_awesome_email_address.com")),
                                               
                                               
                                               
                                               title = tagList(
                                                 tags$span(
                                                   class = "logo-mini", "small"
                                                 ),
                                                 tags$span(
                                                   class = "logo-lg", "LONGER TEXT"
                                                 )
                                               )),
  sidebar = shinydashboardPlus::dashboardSidebar(
    minified= TRUE,
    collapsed = TRUE,
    
    sidebarMenu(
    ),
    tags$script(JS("document.getElementsByClassName('sidebar-toggle')[0].style.visibility = 'hidden';"))
    
  ),
  body = shinydashboard::dashboardBody(
    tabItems(
      
      tabItem(tabName = "mainPanel_1",
              box(
              )
      )
    ),
    controlbar = NULL,
    footer = NULL
  )
)


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

shinyApp(ui, server)

在此处输入图像描述

任何帮助或提示将不胜感激。

4

1 回答 1

1

将此样式用于您的按钮:

style='height: 20px;
    background: transparent;
    border: none;
    font-size: 2rem;
    transform: translate(5%, -30%);'
于 2021-08-26T21:40:56.180 回答