如何将选项卡移动到 R Shiny 侧边栏的底部?
How to move a tab to the bottom of the sidebar in R Shiny?
我有一个用 shinyDashboardPlus
构建的闪亮仪表板。我有一个带有多个选项卡的边栏 - 像往常一样,它们在左上角对齐。
我的边栏滚动已修复style = "position: fixed;"
。
我想添加“帮助”/“联系方式”选项卡,但我希望它位于边栏的左下角。我该怎么做?
您必须根据 li-tag 通过 css 设置样式。
请检查以下内容:
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)
我有一个用 shinyDashboardPlus
构建的闪亮仪表板。我有一个带有多个选项卡的边栏 - 像往常一样,它们在左上角对齐。
我的边栏滚动已修复style = "position: fixed;"
。
我想添加“帮助”/“联系方式”选项卡,但我希望它位于边栏的左下角。我该怎么做?
您必须根据 li-tag 通过 css 设置样式。
请检查以下内容:
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)