title: Linking to a tab or panel of a shiny app
body: <p>How do I manage to link from a given shiny part to parts that are located on other tabs/panels?</p>
  
  <h2>Update</h2>
  
  <p>The solution I drafted below works for the explicit case of linking to tabs/panels (and that's what I asked for). </p>
  
  <p><strong>However, I'd be interested to also know about more generic ways of linking parts of a shiny app.</strong></p>
  
  <h2>Example</h2>
  
  <p>I'd like to link from panel A to panel B, but I'm not quite sure what I need to specify as an action when the action link in panel A is clicked.</p>
  
  <p>The value <code>#tab-4527-2</code> came from investigating the HTML output of <code>ui</code>, but I just saw that those values change each time I restart the app.</p>
  
  <pre><code>library(shiny)
  
  # UI ---------------------------------------------------------------------
  
  ui &lt;- fluidPage(
    tabsetPanel(
      tabPanel(
        "A",
        p(),
        actionLink("link_to_tabpanel_b", "Link to panel B")
      ),
      tabPanel(
        "B",
        h3("Some information"),
        tags$li("Item 1"),
        tags$li("Item 2")
      )
    )
  )
  
  # Server ------------------------------------------------------------------
  
  server &lt;- function(input, output, session) {
    observeEvent(input$link_to_tabpanel_b, {
      tags$a(href = "#tab-4527-2")
    })
  }
  
  shinyApp(ui, server)
  </code></pre>