5

I am currently using shinydashboard but I would like to have different sidbar menues associated with content in the main body. Is this possible with shinydashboard?

For example:

I would like to have something like this https://gallery.shinyapps.io/CDCPlot/

See how when you click on the nav bar options the sidebar menu changes as well as the body.

Is that possible in shinydashboad? I like the look and feel of shinydashboard and would rather not go back to shiny.

THe underlying code is here: https://github.com/NLMichaud/WeeklyCDCPlot/blob/master/ui.R

and uses tabpanels and navbar. Is there something similar in shinydashboard?

Any examples with code?

Thank you!

1
  • Hi, did you find an answer for this?
    – lucacerone
    Mar 8, 2016 at 10:27

2 Answers 2

Reset to default

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

3

What you are asking is tricky and might not be possible because in shinydashboard, top-level navigation controls are located inside the dashboardSidebar (on the left side) and the content is contained inside dashboardBody (on the right side). If you place a navMenu inside dashboardBody, it would have to belong to a specific sidebar item and would disappear if you later click on another sidebar item.

You might need to change the way you want to achieve this. Depending on what you want to do, you might try :

creating a dashboardSidebar with menu items that would normally into the top-menu, and you can place all the controls for that menu under the associated tabItem. You can even make it all dynamic by using renderMenu() in server.R :

output$menu <- renderMenu({
   sidebarMenu(id = "sidebMenu",
       menuItem("Load Data", tabName = "loadData", icon = icon("database"),
          actionButton("press", "Press me")
   )
})

The disadvantage of this is probably that the number of controls you can put inside a sidebar menu is limited while it still looks good. But this is how dashboard is made.

or

using a fullscreen dashboard without sidebar with dashboardSidebar(disable = TRUE) and use a navigation menu in a similar way as in the example you mentioned. You will have no shinydashboard's sidebar and you would have to make your own sidebar just like in your example. This way, you might still enjoy the other features offered by shinydashboard like notifications, boxes, skins, status boxes etc. But this is just a suggestion, it is up to you.

Hope this helps.

0

maybe you want something like:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
ui <- fluidPage( navbarPage(title = "AA Tester", windowTitle ="AA Tester", id="tabactive", 
                            tabPanel("Explore Funds",icon = icon("table"),tags$body(class="skin-blue sidebar-mini control-sidebar-open",
                                                                                    dashboardPagePlus(sidebar_fullCollapse=TRUE,
                                                                                                                                                          dashboardHeaderPlus(disable = T,
                                                                                                                                                                              enable_rightsidebar = TRUE,
                                                                                                                                                                              rightSidebarIcon = "gears"





                                                                                                                                                          ),


                                                                                                                                                          dashboardSidebar(),

                                                                                                                                                          dashboardBody(

                                                                                                                                                          ),
                                                                                                                                                          rightsidebar = rightSidebar(
                                                                                                                                                            background = "dark",
                                                                                                                                                            rightSidebarTabContent(
                                                                                                                                                              id = 1,
                                                                                                                                                              title = "Controllers",
                                                                                                                                                              icon = "desktop",
                                                                                                                                                              active = TRUE





                                                                                                                                                            ))


                            ))),
                            tabPanel("Holdings Analysis",icon = icon("line-chart"))))
server <- function(input, output, session) {}
shinyApp(ui = ui, server = server)                                                                                                                                                          

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.