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")
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With