【发布时间】:2021-01-03 06:14:09
【问题描述】:
我有一个用shinyDashboardPlus 构建的闪亮仪表板。我有一个带有多个标签的侧边栏 - 像往常一样,它们在左上角对齐。
我的侧边栏滚动是用style = "position: fixed;" 修复的。
我想添加一个帮助/联系人选项卡,但我希望它位于侧边栏的左下角。我该怎么做?
【问题讨论】:
标签: r shiny dashboard shinydashboard sidebar
我有一个用shinyDashboardPlus 构建的闪亮仪表板。我有一个带有多个标签的侧边栏 - 像往常一样,它们在左上角对齐。
我的侧边栏滚动是用style = "position: fixed;" 修复的。
我想添加一个帮助/联系人选项卡,但我希望它位于侧边栏的左下角。我该怎么做?
【问题讨论】:
标签: r shiny dashboard shinydashboard sidebar
您必须通过 css 设置相应的 li-tag 样式。
请检查以下内容:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Simple tabs"),
dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Widgets", icon = icon("th"), tabName = "widgets",
badgeLabel = "new", badgeColor = "green")
)
),
dashboardBody(
tags$head(
tags$style(HTML("
#sidebarItemExpanded > ul > :last-child {
position: absolute;
bottom: 0;
width: 100%;
background-color: red;
}
"))),
tabItems(
tabItem(tabName = "dashboard",
h2("Dashboard tab content")
),
tabItem(tabName = "widgets", id = "widgetstabid",
h2("Widgets tab content")
)
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
【讨论】: