shinydashboard vs shinydashboardPlus - 仪表板侧栏标题差异
shinydashboard vs shinydashboardPlus - dashboardsidebar title differences
我有一个用 shinydashboard 构建的 Shiny 应用程序,我刚刚发现了 shinydashboardPlus。一个不错的选择是将侧边栏菜单“缩小”,或者在最小化时它不会完全消失,而只是显示每个菜单项的图标。但是,对于 shinydashboardPlus,当缩小时,标题会被砍掉。使用 shinydashboard,标题保持不变,但侧边栏完全消失。
示例代码:
library(shiny)
library(shinydashboard)
#library(shinydashboardPlus)
# Basic dashboard page template
shinyApp(
ui = dashboardPage(
dashboardHeader(title = "Example"),
dashboardSidebar(#minified = TRUE,
sidebarMenu(
menuItem('Menu1', tabName = 'Menu1',
icon = icon('folder-open')),
menuItem('Menu2', tabName = 'Menu2',
icon = icon('code-branch'))
)
),
dashboardBody()
),
server = function(input, output) { }
)
保留注释标记,运行 它使用 shinydashboard,最初给出:
并且当点击汉堡最小化侧边栏时,整个侧边栏消失:
如果删除评论标记以便它使用 shinydashboardPlus 运行,最小化它会出现这个,我在边栏中有图标,但标题被截断了:
有没有办法让 shinydashboardPlus 缩小,只显示图标,但不砍掉标题?
给你
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
# Basic dashboard page template
shinyApp(
ui = dashboardPage(
dashboardHeader(title = "Example"),
dashboardSidebar(#minified = TRUE,
sidebarMenu(
menuItem('Menu1', tabName = 'Menu1',
icon = icon('folder-open')),
menuItem('Menu2', tabName = 'Menu2',
icon = icon('code-branch'))
)
),
dashboardBody(
tags$style(
'
@media (min-width: 768px){
.sidebar-mini.sidebar-collapse .main-header .logo {
width: 230px;
}
.sidebar-mini.sidebar-collapse .main-header .navbar {
margin-left: 230px;
}
}
'
)
)
),
server = function(input, output) { }
)
我有一个用 shinydashboard 构建的 Shiny 应用程序,我刚刚发现了 shinydashboardPlus。一个不错的选择是将侧边栏菜单“缩小”,或者在最小化时它不会完全消失,而只是显示每个菜单项的图标。但是,对于 shinydashboardPlus,当缩小时,标题会被砍掉。使用 shinydashboard,标题保持不变,但侧边栏完全消失。
示例代码:
library(shiny)
library(shinydashboard)
#library(shinydashboardPlus)
# Basic dashboard page template
shinyApp(
ui = dashboardPage(
dashboardHeader(title = "Example"),
dashboardSidebar(#minified = TRUE,
sidebarMenu(
menuItem('Menu1', tabName = 'Menu1',
icon = icon('folder-open')),
menuItem('Menu2', tabName = 'Menu2',
icon = icon('code-branch'))
)
),
dashboardBody()
),
server = function(input, output) { }
)
保留注释标记,运行 它使用 shinydashboard,最初给出:
并且当点击汉堡最小化侧边栏时,整个侧边栏消失:
如果删除评论标记以便它使用 shinydashboardPlus 运行,最小化它会出现这个,我在边栏中有图标,但标题被截断了:
有没有办法让 shinydashboardPlus 缩小,只显示图标,但不砍掉标题?
给你
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
# Basic dashboard page template
shinyApp(
ui = dashboardPage(
dashboardHeader(title = "Example"),
dashboardSidebar(#minified = TRUE,
sidebarMenu(
menuItem('Menu1', tabName = 'Menu1',
icon = icon('folder-open')),
menuItem('Menu2', tabName = 'Menu2',
icon = icon('code-branch'))
)
),
dashboardBody(
tags$style(
'
@media (min-width: 768px){
.sidebar-mini.sidebar-collapse .main-header .logo {
width: 230px;
}
.sidebar-mini.sidebar-collapse .main-header .navbar {
margin-left: 230px;
}
}
'
)
)
),
server = function(input, output) { }
)