Build Consistent 'shiny' App Layouts with Less Code

Short, consistent wrappers around 'shiny', 'bslib' and 'shinyjs' for building multi-page 'shiny' apps. One function call builds the page with a navigation bar, logo, title and dark mode switch. Tab functions nest pages up to three levels deep, with optional sidebars. Input functions create full-width inputs with optional information tooltips, and helpers switch buttons on and off and show or hide tabs from the server. Includes a starter app template and an example app that explores the Titanic passenger data.


EZRShiny

EZRShiny helps you build multi-page 'shiny' apps that all look and work the same way, with far less code. Describe your app as a set of tabs, fill them with inputs and outputs, and EZRShiny builds the page: navigation bar, logos, app name, sidebars, tooltips and a dark mode switch.

library(EZRShiny)

ui <- UINav(
  appName = "My App",
  barColor = "#1F4E79",

  singleTab("Upload",
    navUpload("dataUpload", "Upload a CSV",
              tooltipText = "CSV files only"),
    navButton("runData", "Run")
  ),

  biLevelTab("Results",
    subSidebarTab("Table",
      sidebarElements = list(navDownload("tableDownload", "Download table")),
      navOutputTable("resultsTable")
    ),
    subTab("Plot",
      navOutputPlot("resultsPlot")
    )
  )
)

Installation

Once EZRShiny is on CRAN:

install.packages("EZRShiny")

Until then, install the latest version from GitHub:

# install.packages("remotes")
remotes::install_github("vari-bbc/EZRShiny")

This skips the "Getting started" guide by default. To install the guide too, so vignette("getting-started", package = "EZRShiny") works (this needs pandoc, which RStudio includes):

remotes::install_github("vari-bbc/EZRShiny", build_vignettes = TRUE)

Or install from a local copy of the folder:

# install.packages("devtools")
devtools::install("path/to/EZRShiny")

Getting started

Start a new app from the template:

EZRShiny::createEZApp("myApp", appName = "My App")
shiny::runApp("myApp")

Or open the example app, which explores who survived the Titanic and uses every kind of tab:

EZRShiny::runExampleApp()

Then read the guide, which covers the folder layout, every tab, input and output function, and the server helpers:

vignette("getting-started", package = "EZRShiny")

What's included

Group Functions
Page UINav()
Top-level tabs singleTab(), sidebarLevelTab(), biLevelTab(), triLevelTab()
Sub tabs subTab(), subSidebarTab(), triSubTab(), triSubSidebarTab(), subTwoColPage()
Inputs navButton(), navSelect(), navUpload(), navDownload(), navCheckbox(), navText(), navNumeric(), navColor(), navDate(), navSpanText()
Outputs navOutputTable(), navOutputPlot(), navOutputPlotly(), navOutputGirafe(), navOutputPic(), sideNavOutputPic(), navOutputText()
Server activateItems(), deactivateItems(), showNavTabs(), hideNavTabs(), startSection(), endSection()
Files sourceFunctions(), createEZApp(), runExampleApp()

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("EZRShiny")

0.1.0 by Daniella DeWeerd, 9 hours ago


https://github.com/vari-bbc/EZRShiny


Report a bug at https://github.com/vari-bbc/EZRShiny/issues


Browse source code at https://github.com/cran/EZRShiny


Authors: Daniella DeWeerd [aut, cre, cph] , Van Andel Institute [cph, fnd]


Documentation:   PDF Manual  


GPL-3 license


Imports bsicons, bslib, colourpicker, DT, ggiraph, here, plotly, shiny, shinyjs, shinyWidgets, utils

Suggests datasets, ggplot2, htmltools, knitr, rmarkdown, testthat, withr


See at CRAN