title: Shiny Dashboard: Render multiple menu items and output dynamic content to each
body: <p>I need to render various menu sub-items based on some reactive data values. For each sub-item, I also need to associate linked output. I tried to link with <code>tabName</code>, but not sure what went wrong.</p>
  
  <p>Below is an example. The desired output will be one box for each menu item/sub-item.</p>
  
  <pre><code>## This code snippet doesn't do what I need ----
  shinyApp(
    ui = dashboardPage(
      dashboardHeader(),
      dashboardSidebar(
        sidebarMenu(
          menuItemOutput("dynamic_menu"),
          menuItem("Menu2", tabName = "menu2")
        )
      ),
      dashboardBody(
        tabItems(
          uiOutput("menu1_content"),
          tabItem(tabName = "menu2", box("I am menu2"))
        )
      ),
      title = "Example"
    ),
  
    server = function(input, output) {
      output$dynamic_menu &lt;- renderMenu({
        submenu_list &lt;- lapply(letters[1:5], function(x) {
          menuSubItem(x, tabName = paste0("menu1-", x))
        })
        menuItem(
          text = "Menu1",
          startExpanded = TRUE,
          do.call(tagList, submenu_list)
        )
      })
  
      output$menu1_content &lt;- renderUI({
        content_list &lt;- lapply(letters[1:5], function(x) {
          tabItem(
            tabName = paste0("menu1-", x),
            box(x)
          )
        })
        do.call(tagList, content_list)
      })
    }
  )
  
  
  ## This code snippet does what I need ----
  shinyApp(
    ui = dashboardPage(
      dashboardHeader(),
      dashboardSidebar(
        sidebarMenu(
          menuItem(
            "Menu1", startExpanded = TRUE,
            menuSubItem("a", tabName = "menu1-a"),
            menuSubItem("b", tabName = "menu1-b"),
            menuSubItem("c", tabName = "menu1-c"),
            menuSubItem("d", tabName = "menu1-d"),
            menuSubItem("e", tabName = "menu1-e")
          ),
          menuItem("Menu2", tabName = "menu2")
        )
      ),
      dashboardBody(
        tabItems(
          tabItem(tabName = "menu1-a", box("a")),
          tabItem(tabName = "menu1-b", box("b")),
          tabItem(tabName = "menu1-c", box("c")),
          tabItem(tabName = "menu1-d", box("d")),
          tabItem(tabName = "menu1-e", box("e")),
          tabItem(tabName = "menu2", box("I am menu2"))
        ),
        title = "Example"
      )
    ),
    server = function(input, output) {}
  )
  </code></pre>