Felix Analytix

Felix Analytix

Share this post

Felix Analytix
Felix Analytix
How to Create Multiple Pages Dashboards with R Shiny

How to Create Multiple Pages Dashboards with R Shiny

Using bs4Dash to create an R Shiny dashboard with multiple pages in a sidebar

Felix Analytix's avatar
Felix Analytix
Aug 10, 2024
∙ Paid
4

Share this post

Felix Analytix
Felix Analytix
How to Create Multiple Pages Dashboards with R Shiny
Share

Coders!

Would you like to know how to create multiple pages dashboards using R Shiny?

In this tutorial you will learn how to:

  • create multiple pages using the bs4Dash R package;

  • build a fully customized sidebar with a logo and different categories of texts;

  • add a footer in your R Shiny dashboards;

  • change the theme and colors using Bootstrap 4;

  • and more…

Watch the video now:

In this tutorial, you’ll learn how to create a dashboard with multiple tabs that function as different pages. While Shiny applications are technically single-page applications, we can create the illusion of multiple pages using tabs and navigation elements.

Required Packages

To create a dashboard with multiple pages, you’ll need to install the shiny package (if you haven’t already) and the bs4Dash package developed by David Granjon. Let’s start by installing and loading these packages:

# Install R packages if not installed

if (!require(shiny)) install.packages("shiny")
if (!require(bs4Dash)) install.packages("bs4Dash")

Subscribe to get the R code for free

Creating an Empty Skeleton

Let’s begin with an empty skeleton to understand the basic structure of a bs4Dash application:

# Empty skeleton

library(shiny)
library(bs4Dash)

ui <- dashboardPage(
  title = "Basic Dashboard",
  header = dashboardHeader(),
  sidebar = dashboardSidebar(),
  controlbar = dashboardControlbar(),
  footer = dashboardFooter(),
  body = dashboardBody()
)

server <- function(input, output) {}

shinyApp(ui = ui, server = server)

This creates a basic dashboard with an empty sidebar. If you’re not familiar with Shiny’s structure (UI, server, and the interaction between them), I recommend checking out my previous videos in this series.

Understanding the Dashboard Structure

The dashboardPage() function is the main container for your bs4Dash application. It accepts several arguments:

  • header: The top navigation bar

  • sidebar: The left navigation panel

  • controlbar: An optional right sidebar

  • footer: The bottom section

  • body: The main content area

For this tutorial, we’ll focus primarily on the user interface (UI) since our server function remains empty - we’re concentrating on layout and navigation rather than reactive functionality.

Building a Complete Dashboard

Now let’s create a full example with multiple pages. Here’s the complete code that demonstrates all the key concepts:

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Felix Analytix
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share