Skip to content

Conversation

@cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented May 12, 2021

(To be merged after rstudio/htmltools#224)

This PR moves essentially all of the server-side logic behind {shiny}'s tabPanel() logic and exports it via a new API (in future PRs, we'll be expanding on this new API to provide new functionality). Here's a map from the old API to the new one:

Creating navs

  • nav() (i.e., tabPanel())
  • nav_menu() (i.e., navbarMenu())
  • navs_tab() (i.e., tabsetPanel(type = "tabs"))
  • navs_pill() (i.e., tabsetPanel(type = "pill"))
  • navs_hidden() (i.e., tabsetPanel(type = "hidden"))
  • navs_pill_list() (i.e., navlistPanel())
  • navs_bar() (i.e., navbarPage())

Note that the navs_*() consumer functions (e.g., navs_tab()) generate a result that prints a static HTML page

tabs <- navs_tab(
  nav("a", "a"),
  nav("b", "b")
)
tabs

Screen Shot 2021-05-12 at 6 26 57 PM

But you can also put them inside new page constructor functions that default theme to bs_theme() (the latest recommended version of Bootstrap).

page_fluid(tabs)

Updating navs

  • nav_select() (i.e., updateTabsetPanel())
  • nav_insert() (i.e., insertTab())
  • nav_prepend() (i.e., prependTab())
  • nav_append() (i.e., appendTab())
  • nav_remove() (i.e., removeTab())
  • nav_show() (i.e., showTab())
  • nav_hide() (i.e., hideTab())

@cpsievert cpsievert marked this pull request as ready for review May 24, 2021 18:41
@cpsievert cpsievert merged commit 112ae6e into master May 25, 2021
@cpsievert cpsievert deleted the nav-legacy branch May 25, 2021 13:50
@cpsievert cpsievert mentioned this pull request May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants