问题描述
如何在 Shiny 的 UI 中添加页脚注释或免责声明?这是我目前的布局,
shinyUI(pageWithSidebar(headerPanel("我的标题"),侧边栏面板(侧边栏"),主面板(你好世界")))
我已经检查了这个
更高级的使用footer.html
我有自己的带有 css 和徽标样式的 footer.html 文件.将您的 footer.html 文件与闪亮文件放在同一位置并使用 includeHTML
.我用一个 div 包裹起来,所以任何 css 都会被选中.
在上面的例子中,替换行:
print(~~~我的免责声明~~~~")
与:
div(类=页脚",includeHTML(footer.html"))
How can I add footer notes or disclaimer in Shiny's UI? This is my current layout,
shinyUI(
pageWithSidebar(
headerPanel("My Title"),
sidebarPanel("sidebar"),
mainPanel("hello world")
)
)
I have checked this page but no mention of this. Any ideas?
What I need is,
My Title
sidebar hello world (plots)
----------------------------
disclaimer
Here is an example for other Shiny
happy people to use.
Note that I have updated the above example to sidebarLayout
as ?pageWithSidebar
help states:
Basic example of footer
I have made example the all in one app.r
style so people can test this, but if you have a ui.R
file just add a row just before end of your fluidPage
call. I use a horizontal rule (hr) just before the footer to make the footer stand out, but this is up to you. I notice navbarPage
has a header and footer parameter you can set.
# app.R
library(shiny)
ui<- shinyUI(
fluidPage(
title = "Footer example App",
sidebarLayout(
sidebarPanel(
"sidebar",
selectInput(
"pet",
"Pet",
c("Cat", "Dog", "Fish")
)
),
mainPanel("hello world")
),
# WHERE YOUR FOOTER GOES
hr(),
print("~~~my disclaimer~~~~")
)
)
server <- function(input, output) {
# empty for minimal example
}
shinyApp(ui=ui, server = server)
Result
More advanced using footer.html
I have my own footer.html file with css and logo stylings. Place your footer.html file in your same place as your shiny files and use includeHTML
. I wrap with a div so any css gets picked up.
In above example, replace line:
print("~~~my disclaimer~~~~")
With:
div(
class = "footer",
includeHTML("footer.html")
)
这篇关于闪亮的布局 - 如何添加页脚免责声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!