闪亮的布局 - 如何添加页脚免责声明? [英] Shiny layout - how to add footer disclaimer?

查看:144
本文介绍了闪亮的布局 - 如何添加页脚免责声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 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:

pageWithSidebar - This function is deprecated. You should use fluidPage along with sidebarLayout to implement a page with a sidebar.

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")
    )

这篇关于闪亮的布局 - 如何添加页脚免责声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆