Skip to content

markusdumke/shinynavbar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shinynavbar

Lifecycle: maturing license

This is a reimplementation of Shiny’s navbarPage and tabset functionality with more features and flexibility.

Installation

You can install shinynavbar with:

# install.packages("devtools")
devtools::install_github("markusdumke/shinynavbar")

Here is an example:

library(shiny)
library(shinynavbar)

ui <- bootstrapPage(
  tags$head(tags$style(".active a {background-color: #f8f8f8 !important}
                       .navbar-brand {padding: 0 0 !important}")),
  navbar(position = "static-top",
         ## use image as brand
         navbarHeader(navbarBrand("Brand")),
         ## these elements appear on the right
         navbarHeader(navbarButton("Logout"),
                      navbarCollapseButton(),
                      pull = "right"),
         ## the classical navbar with a text form
         navbarCollapse(navbarNav(navTab("Tab1"),
                                  navTab("Tab2"),
                                  navTab("Tab3")),
                        navbarForm(textInputNoLabel("text")))
  ),
  div(
    class = "container-fluid",
    divTabContent(
      divTabPane("Tab1", h2("This is tab1")),
      divTabPane("Tab2", h2("This is tab2")),
      divTabPane("Tab3", h2("This is tab3"))
    )
  )
)

server <- function(input, output, session) {
  session$onSessionEnded(stopApp)

  observeEvent(input$navbar, {
    print(input$navbar)
  })

  observeEvent(input$Logout, {
    print("Logged out")
  })

  ## clicked on brand image
  observeEvent(input$Brand, {
    print("Brand")
  })
}

shinyApp(ui, server)

About

shinyNavbarPage with more flexibility

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages