r - Shinydashboard 标题中的自动换行或换行
问题描述
我正在使用 ashinydashboard
但是当标题太长时,它无法换行。我曾尝试使用来完成此操作,但即使在这种情况下<br/>
也无法使用它。HTML()
我知道我可以使用 使标题空间更宽titleWidth
,但在许多情况下看起来并不那么好。
实现这一目标的最简单方法是什么?
这是一个例子:
library(shiny)
library(shinydashboard)
## Only run this example in interactive R sessions
if (interactive()) {
header <- dashboardHeader(title = "This title is just way too long")
sidebar <- dashboardSidebar(
sidebarUserPanel("User Name",
subtitle = a(href = "#", icon("circle", class = "text-success"), "Online"),
# Image file should be in www/ subdir
image = "userimage.png"
),
sidebarSearchForm(label = "Enter a number", "searchText", "searchButton"),
sidebarMenu(
# Setting id makes input$tabs give the tabName of currently-selected tab
id = "tabs",
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Widgets", icon = icon("th"), tabName = "widgets", badgeLabel = "new",
badgeColor = "green"),
menuItem("Charts", icon = icon("bar-chart-o"),
menuSubItem("Sub-item 1", tabName = "subitem1"),
menuSubItem("Sub-item 2", tabName = "subitem2")
)
)
)
body <- dashboardBody(
tabItems(
tabItem("dashboard",
div(p("Dashboard tab content"))
),
tabItem("widgets",
"Widgets tab content"
),
tabItem("subitem1",
"Sub-item 1 tab content"
),
tabItem("subitem2",
"Sub-item 2 tab content"
)
)
)
shinyApp(
ui = dashboardPage(header, sidebar, body),
server = function(input, output) { }
)
}
目标是应用自动换行,以便我们可以阅读整个标题(即"This title is just way too long"
)。
解决方案
推荐阅读
- algorithm - 基于贝塞尔曲线的最佳身体旋转重新定位
- php - Foreach 更改 html 元素以显示不同的选项卡
- c++ - 单击鼠标后更改复选框的文本颜色
- javascript - 我如何在 fastify 中使用 exceljs?
- r - eval 中的错误(predvars,data,env):在编织时找不到对象“column_name”,但在不编织时找到
- android - 无法访问 viewBinding
- python - Heroku上的Django:/关系“theblog_category”处的ProgrammingError不存在
- r - 更改 as.Date 的默认行为
- powershell - 如何在不显着增加其大小的情况下在 PowerShell 中保存文本文件?
- html - 通过单击内部 div 更改外部 div 的颜色(仅 css 和 html)