闪亮的布局-如何添加页脚免责声明?

时间:2021-04-09 14:29:20

How can I add footer notes or disclaimer in Shiny's UI? This is my current layout,

如何在闪亮的UI中添加脚注或免责声明?这是我现在的布局,

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

1 个解决方案

#1


4  

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:

注意,我已将上面的示例更新为? pagewith边栏帮助说明:

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

pagewith边栏—不赞成使用此功能。您应该使用fluidPage和sidebarLayout来实现一个带有工具条的页面。

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样式中创建了all的示例,这样人们可以测试它,但是如果你有一个ui。R文件只是在fluidPage调用结束前添加一行。我在页脚之前使用了一条水平规则(hr)来突出页脚,但这取决于您。我注意到navbarPage有一个可以设置的页眉和页脚参数。

# 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

更高级的使用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.

我有自己的页脚。带有css和标志样式的html文件。把你的页脚。html文件在您的地方与您的闪亮文件和使用包括html。我用div结束,这样任何css都会被选中。

In above example, replace line:

在上面的示例中,替换行:

    print("~~~my disclaimer~~~~")

With:

:

    div(class = "footer",
        includeHTML("footer.html")
    ))

#1


4  

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:

注意,我已将上面的示例更新为? pagewith边栏帮助说明:

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

pagewith边栏—不赞成使用此功能。您应该使用fluidPage和sidebarLayout来实现一个带有工具条的页面。

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样式中创建了all的示例,这样人们可以测试它,但是如果你有一个ui。R文件只是在fluidPage调用结束前添加一行。我在页脚之前使用了一条水平规则(hr)来突出页脚,但这取决于您。我注意到navbarPage有一个可以设置的页眉和页脚参数。

# 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

更高级的使用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.

我有自己的页脚。带有css和标志样式的html文件。把你的页脚。html文件在您的地方与您的闪亮文件和使用包括html。我用div结束,这样任何css都会被选中。

In above example, replace line:

在上面的示例中,替换行:

    print("~~~my disclaimer~~~~")

With:

:

    div(class = "footer",
        includeHTML("footer.html")
    ))