I want to link to a specific content of another tabPanel
within an R Shiny app. I've found plenty of advice on how to do the half part of it respectively: there are solutions how to use an anchor
tag to link to content within a tabPanel
...
... and on hwo to direct the link to another tabPanel
:
- SO: [Shiny]: Add link to another tabPanel in another tabPanel
- SO: Linking to a tab or panel of a shiny app
- SO: Externally link to specific tabPanel in Shiny App
- Creating Internal Links - Defining Application Navigation by David Ruvolo
However, I need a combination of both: a link switching the view to another tabPanel
at a specific location. In this app, based on mihasa's example, there are two tabPanels
, where the first (Home
) holds some text upon clicking that, the app should redirect to a section with the id visitme
in Tab2
.
library(shiny)
ui = shinyUI(
navbarPage("Header",
tabPanel("Home",
fluidPage(
"bring me to the desired point in Tab2")),
tabPanel("Tab2",
"Some Text inside Tab 2.",
div("This is a long div to visualize the redirection",
style = "background-color: gray;
height: 1000px;
width: 100px;"),
div(id = "visitme",
"This is the part where the redirection shall land."),
div("Another long div",
style = "background-color: gray;
height: 500px;
width: 100px;"))))
server = function(input, output, session){}
runApp(shinyApp(ui, server), launch.browser = TRUE)