diff --git a/NEWS.md b/NEWS.md index d456c73f9..4db61489c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # bslib (development version) +* `navset_card_pills()`, `navset_card_underline()`, `navset_card_tabs()` fixed to now respect header/footer arguments (@tanho63, #1024) + # bslib 0.8.0 ## Breaking changes diff --git a/R/navs-legacy.R b/R/navs-legacy.R index aaac3419e..58f2c79b4 100644 --- a/R/navs-legacy.R +++ b/R/navs-legacy.R @@ -13,9 +13,13 @@ #' @param selected a character string matching the `value` of a particular #' [nav_panel()] item to selected by default. #' @param header UI element(s) ([htmltools::tags]) to display _above_ the nav -#' content. +#' content. For `card`-based navsets, these elements are implicitly wrapped in +#' a `card_body()`. To control things like `padding`, `fill`, etc., wrap the +#' elements in an explicit [card_body()]. #' @param footer UI element(s) ([htmltools::tags]) to display _below_ the nav -#' content. +#' content. For `card`-based navsets, these elements are implicitly wrapped in +#' a `card_body()`. To control things like `padding`, `fill`, etc., wrap the +#' elements in an explicit [card_body()]. #' #' @seealso [nav_panel()], [nav_panel_hidden()] create panels of content. #' @seealso [nav_menu()], [nav_item()], [nav_spacer()] create menus, items, or diff --git a/R/navs.R b/R/navs.R index dcc79687f..a3cfa7b51 100644 --- a/R/navs.R +++ b/R/navs.R @@ -52,10 +52,7 @@ navset_card_pill <- function( items <- collect_nav_items(..., wrapper = wrapper) - pills <- navset_pill( - !!!items, id = id, selected = selected, - header = header, footer = footer - ) + pills <- navset_pill(!!!items, id = id, selected = selected) above <- match.arg(placement) == "above" @@ -75,7 +72,9 @@ navset_card_pill <- function( height = height, full_screen = full_screen, if (above) card_header(!!!nav_args), + header, navs_card_body(content, sidebar), + footer, if (!above) card_footer(!!!nav_args) ) } @@ -129,9 +128,7 @@ navset_card <- function( items <- collect_nav_items(..., wrapper = wrapper) - tabs <- navset_func( - !!!items, id = id, selected = selected, header = header, footer = footer - ) + tabs <- navset_func(!!!items, id = id, selected = selected) tabQ <- tagQuery(tabs) @@ -147,7 +144,9 @@ navset_card <- function( } else { card_header(nav) }, - navs_card_body(content, sidebar) + header, + navs_card_body(content, sidebar), + footer ) }