Is it possible to use panels with navbarPage
, navlistPanel
, navbarMenu
or tabsetPanel
without showing the navigation menu?
I wrote the following script:
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
navbarPage
(
title = NULL, id = "navBar",
tabPanel
(
title = "01", value = "panel01",
h1("First panel", align = "center"),
actionButton("next01", "Next", width = "10%")
),
tabPanel
(
title = "02", value = "panel02",
h1("Second panel", align = "center"),
actionButton("prev02", "Previous", width = "10%")
)
)
)
server <- function(input, output, session)
{
observe(
{
hide(selector = "#navBar li a[data-value=panel02]")
})
observeEvent(input$next01,
{
hide(selector = "#navBar li a[data-value=panel01]")
show(selector = "#navBar li a[data-value=panel02]")
updateNavbarPage(session, "navBar", selected="panel02")
})
observeEvent(input$prev02,
{
hide(selector = "#navBar li a[data-value=panel02]")
show(selector = "#navBar li a[data-value=panel01]")
updateNavbarPage(session, "navBar", selected="panel01")
})
}
shinyApp(ui = ui, server = server)
Since I have a 'previous' and 'next' button at the bottom of each panel, I don't need the menu and would like to get rid of the navigation menu on top of each panel.