bslib icon indicating copy to clipboard operation
bslib copied to clipboard

Feature Request: allow specifying nav style for `page_navbar()`

Open nteetor opened this issue 1 year ago • 3 comments

BS5 made changing the style of the nav component nicely straightforward, https://getbootstrap.com/docs/5.3/components/navs-tabs/#available-styles. I am hoping bslib could allow developers to add the various nav style classes to the nav component of page_navbar(). Alternatively, the developer could pass in a navset_ call?

nteetor avatar May 26 '23 21:05 nteetor

You can do a good amount of this today via tagAppendAttributes()'s new-ish .cssSelector:

library(bslib)
library(htmltools)

navset_card_pill(nav_panel("A", "a"), nav_panel("B", "b")) |>
  tagAppendAttributes(class = "justify-content-center", .cssSelector = ".nav")

Note that {bslib} isn't yet up-to-date with Bootstrap 5.3 though, so .nav-underline doesn't work (yet)

cpsievert avatar May 31 '23 17:05 cpsievert

I'm currently using a small bit of JS to apply the nav-pills class to the navigation bar nav.

nteetor avatar Jun 01 '23 14:06 nteetor

FYI: In the next release (or current dev) we now have navset_underline(), navset_card_underline() and page_navbar(underline = TRUE).

I'm leaving this issue open though because we should still think about a way to pass attributes to the navset constructor.

gadenbuie avatar Oct 20 '23 17:10 gadenbuie