bs4Dash icon indicating copy to clipboard operation
bs4Dash copied to clipboard

Combine shiny::navbarPage layout with bs4Dash elements?

Open mbacou opened this issue 4 years ago • 3 comments

@DivadNojnarg I'd like to use bs4Dash elements (card, valueBox, timeline, etc..), but I need a more standard collapsible top navbar layout (similar to shiny::navbarPage), and I don't need bs4Dash sidebar and controlbar.

Is there a way to manually load bs4Dash CSS/JS dependencies? Or else can I tweak bs4Dash dashboard layout to include a (collapsible) top navbar?

Thx!

mbacou avatar Nov 11 '21 15:11 mbacou

You can use htmltools::findDependencies to extract bs4Dash deps like here: https://unleash-shiny.rinterface.com/htmltools-dependencies.html#htmldeps-import

DivadNojnarg avatar Nov 11 '21 17:11 DivadNojnarg

I've tried that route by adding adminLTE and bs4Dash deps to a shiny::navbarPage(bslib::bs_theme(version="4")), but I end up with a CSS soup (-: So I wouldn't recommend it.

Adding a simple (non-collapsible) top navbar to a bs4Dash page is easy enough (example below). I think the collapsible behavior will require extra work with custom JS/CSS. Any help welcome!

# Navbar ----
navbar <- dashboardHeader(
  rightUi = tags$li(class="navbar-collapse collapse dropdown",
    tags$ul(class="nav navbar-nav sidebar-menu",
      bs4SidebarMenuItem("Page 1", tabName="page-1", selected=TRUE),
      bs4SidebarMenuItem("Page 2", tabName="page-2"),
      bs4SidebarMenuItem("Page 3", tabName="page-3")
    )
  )
)

mbacou avatar Nov 11 '21 17:11 mbacou

In case others are interested, there's also the option to do without bs4Dash altogether and try to use widgets provided by other packages (summaryBox, timevis, shinyWidgets, etc.).

mbacou avatar Nov 11 '21 18:11 mbacou