The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Top Navigation Prototype

library(bs4Dashkit)

use_dash_topnav() is a prototype layout helper for {bs4Dash} apps that should feel more like a top-navigation app than a sidebar app.

The app still defines a regular bs4DashSidebar() with a bs4SidebarMenu(). bs4Dashkit hides that sidebar, mirrors the menu into the navbar, and delegates clicks back to the original sidebar links. That keeps native {bs4Dash} tab switching, input$sidebar, updateTabItems(), and bookmarking behavior intact.

Mobile, style, and overflow

By default, mobile top-nav mode uses a hamburger button for tabs:

use_bs4Dashkit_core(
  ttl,
  layout = "topnav",
  topnav = dash_topnav_options(mobile = "collapse")
)

Use mobile = "scroll" if you prefer a single horizontally scrollable row on small screens. Mobile top-nav modes work best without a centered navbar title once the viewport starts to tighten; keep title = "auto" so bs4Dashkit hides dash_nav_title() early when the tab row needs room, or set title = "hide" for a permanently tab-first navbar.

topnav_style controls the tab treatment:

use_bs4Dashkit_core(
  ttl,
  layout = "topnav",
  topnav = dash_topnav_options(style = "underline")
)
use_bs4Dashkit_core(
  ttl,
  layout = "topnav",
  topnav = dash_topnav_options(style = "pill")
)
use_bs4Dashkit_core(
  ttl,
  layout = "topnav",
  topnav = dash_topnav_options(style = "compact")
)

The underline style uses a small animated indicator that moves when the active tab changes.

For crowded desktop navbars, move later tabs into a More dropdown:

use_bs4Dashkit_core(
  ttl,
  layout = "topnav",
  topnav = dash_topnav_options(
    overflow = "more",
    more_after = 4
  )
)

title = "auto" compacts a centered dash_nav_title() when tabs need room, then hides it if there still is not enough space. Use "show", "compact", or "hide" when you want explicit behavior.

Top-nav clicks also emit a Shiny event:

observeEvent(input$bs4dashkit_topnav, {
  str(input$bs4dashkit_topnav)
})

If the page body needs a simple title synced from the active tab, enable:

use_bs4Dashkit_core(
  ttl,
  layout = "topnav",
  topnav = dash_topnav_options(page_title = "tab")
)

You can also call use_dash_topnav() directly if you assemble the other dependencies yourself:

bs4DashBody(
  use_bs4Dashkit(),
  ttl$deps,
  use_dash_theme_preset("professional"),
  use_dash_topnav(topbar_h = "56px", align = "left", gap = 6, mobile = "collapse")
)

Runnable example

The package ships a prototype app that exercises flat menu items, dropdown sub-items, navbar utilities, footer styling, theme presets, and server-side tab updates:

shiny::runApp(system.file("examples", "topnav-prototype", package = "bs4Dashkit"))

This feature is intentionally conservative: the hidden sidebar remains the source of truth, and the top-nav layer mirrors it rather than replacing {bs4Dash} internals.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.