`page_navbar` footer options
Nobody has claimed this yet.
- Dominant language
- SCSS
- Stars
- 569
- Forks
- 72
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 5
Description
I'm making a multi-page Shiny app using page_navbar with multiple nav_panels, which includes a main set of panels plus "Help" and "About" panels at the end.
I've written some custom Shiny module code to add a sticky footer at the bottom of the viewport using divs and css classes, which I apply on a per-panel basis using (a) a class definition, which goes into the app as a free-floating HTML chunk, and (b) a wrapper function around each page that needs the footer. (I can provide more detail if this is unclear.)
ui <- page_navbar(
title = "UI demo",
id = "ui-demo",
),
# This object defines the css classes for the footer with next/back buttons
# i.e., in the module file, navButtonsSetup <- tags$head(tags$style(HTML(" .sticky-footer { ...}" [etc.])))
navButtonsSetup,
nav_panel(
"Overview",
value = "overview",
layout_columns(
col_widths = c(-2, 8, -2),
row_heights = c(1,6),
random_text(nwords = 10),
random_DT(nrow = 20, ncol = 5)
) |> addNavButtons("overview_page") # addNavButtons is a Shiny UI module
),
[etc.]
The footer contains "next" and "back" buttons to toggle between the three main nav panels. The "Help" and "About" pages do not have the footer, because I don't want users to navigate to them using the "next" button.
The "Help" and "About" pages do not have the footer, because I don't want users to navigate to them using the "next" button--that would be confusing.
When I run my app, I get the warning that Navigation containers expect a collection of `bslib::nav_panel()`/`shiny::tabPanel()`s and/or `bslib::nav_menu()`/`shiny::navbarMenu()`s and that I should Consider using `header` or `footer` if you wish to place content above (or below) every panel's contents.
I like the idea of using the built-in header or footer, but it doesn't currently work for my setup (as best as I can tell) because I have 3 panels with a footer, plus 2 panels that need to not have it.
Possible feature
Would it be feasible to either:
- allow the
headerandfooterarguments ofpage_navbarto take a list or a named vector, to match one item per page, such as:footer = list(Data = my_footer, Overview = my_footer, Help = NULL, About = NULL), or - provide
nav_panelwith anoverwrite_header/overwrite_footeroption to let a specific panel "opt out" of the default header/footer?
Thanks in advance for reading through this, please let me know if you need any more details or if there's an existing solution I should know about. :)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the warning with page_navbar, its nav_panel entries, and the current header/footer arguments in a small Shiny app. Read the page_navbar and nav_panel behavior around per-panel content, then determine whether selective footers can be supported without breaking navigation-container validation. Done means the requested panels show the footer while Help and About do not, with coverage for the chosen API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100