This book is still under active development and intended for a 2021 Q2 release in the R Series by Chapman & Hall.

Is this book for me?

Before going further, the reader must:

  • Be comfortable with basic R structures and concepts, functional and object oriented programming (R6).
  • Have solid knowledge of Shiny.

Basic knowledge in HTML, CSS and JavaScript is a plus but not mandatory.

If you fulfill the above prerequisites, you should read this book if you already happened to ask one of the following questions:

  • Do you want to know how to develop shiny apps with a more professional look and feel?
  • Have you ever wondered how to design new input widgets to unleash interactivity?
  • Do you want to better handle JS and CSS in your apps?
  • How may I develop a mobile friendly template for Shiny?
  • How may I include React in my shiny apps?
  • Are you simply curious about what happens under the hood?

Learning objectives

This book will help you to:

  • Understand how Shiny deals with the classic web development standards and what are the main differences.
  • Manipulate Shiny tags from R to create custom layouts.
  • Harness the power of CSS and JavaScript to quickly design apps standing out from the pack.
  • Discover the steps to import and convert existing web frameworks like Bootstrap 4, framework7.
  • Learn how Shiny internally deals with inputs.
  • Learn more about less documented Shiny mechanisms (websockets, sessions, …).

Why another Shiny related book?

There are various Shiny focused resources introducing basic as well as advanced topics such as modules and Javascript/R interactions, however, handling advanced user interfaces design was never an emphasis. Clients often desire custom templates, yet this generally exceeds core features of Shiny (not out of the box).

Generally, R App developers lack a significant background in web development and often find this requirement overwhelming. It was this sentiment that motivated writing this book, namely to provide readers the necessary knowledge to extend Shiny’s layout, input widgets and output elements. This project officially started at the end of 2018 but was stopped when Joe Cheng revealed the upcoming Mastering Shiny Book (Hadley 2021). Fortunately, the later, does not cover the customization of Shiny user interfaces. Besides, this book may constitute a good complement to Engineering Production-Grade Shiny Apps by the ThinkR team (Fay, Rochette, et al. 2020), where the link between Shiny and CSS/JavaScript is covered. For a deep dive into JavaScript and R interactions, the JavaScript for R book by John Coene covers topics like htmlWidgets, interactive documents and computations.

Book structure

This book is organized into seven parts:

  • Part 1 demonstrates the link between Shiny and the classic web languages like HTML, CSS and JavaScript. We gradually introduce some of the necessary web development knowledge to be able to read the book. We explore the web dependencies behind Shiny such as Bootstrap and jQuery. We dive into the htmltools (Cheng, Sievert, et al. 2021) package, providing functions to create and manipulate HTML tags from R as well as manage web dependencies.
  • Part 2 focuses on CSS and Sass. We provide the reader with basic CSS knowledge to get the most out of Sass, a powerful tool to seamlessly alter Shiny apps style, in a more reproducible manner. All along this part, we showcase examples from the R community like fresh (Perrier and Meyer 2021) and bslib (Sievert and Cheng 2021), to significantly beautify apps with only few lines of code.
  • Part 3 contains chapters dedicated to the Shiny input system. This part starts with a JavaScript hands on, then exposes how Shiny works under the hood by introducing the websockets which allows the communication between R and JavaScript. We explore the Shiny input life cycle, that is how they are created and updated. We expose JS techniques to get rid of unnecessary renderUI patterns that may speed up Shiny apps. This part contains many hidden gems to significantly and quickly enhance apps.
  • Part 4 focuses on the development of a new template for Shiny by demonstrating examples from the tablerDash (Granjon 2020) package. These, and more may be explored further as part of the RinteRface project. This case study mobilizes all knowledge acquired in the previous parts.
  • Part 5 introduces a new opinionated package, charpente (Granjon and Coene 2021), that substantially reduce the burden of JavaScript management during the development of Shiny extensions.
  • Part 6 dives into mobile web development through a practical study involving a rework of shinyMobile (Granjon, Perrier, and Rudolf 2021). We give a brief introduction to the progressive web application world with some patterns to get started like service workers, web manifests, offline pages.
  • Part 7 exposes other alternatives like React, taking examples from the reactR (Inc et al. 2021) package.

Parts are sorted by difficulty level, the last one being the most technical. However, this does not mean the reader must read all chapters. Given the very heterogeneous background of the community, some people may focus on the JavaScript section, while others will read the Sass part or the mobile development examples. Some patterns exposed in this book may apply to classic Shiny apps projects, that are not necessarily meant to extend Shiny per se, but may need a highly customized experience. Beyond the aesthetic aspect, this book tries to expose best practices to develop optimized shiny apps!

By the end of that book, the reader should be able to entirely customize Shiny in a reasonable amount of time.

Code structure

This book has a side package containing all the necessary material to run the code without having to reload each previous snippet.


It covers most chapters.

There is another good reason for this package: provide a robust method to bundle JavaScript/CSS code along side any shiny app. Indeed, it is quite tempting to proceed as below:

ui <- fluidPage(
    "$(function() {
      Shiny.addCustomMessageHandler('hello', function(message) {     
  actionButton("go", "Send")

server <- function(input, output, session) {
  observeEvent(input$go, {
    session$sendCustomMessage("hello", message = "plop")

shinyApp(ui, server)

It is fine if the app purpose is a simple demonstration. In our case, since we aim at providing reusable template elements, we need a better approach, that will be described later.

Extra material

This book may serve as material for workshops. See below a list of recent events.

e-Rum 2020

Novartis associates Mustapha Larbaoui and David Granjon gave a workshop entitled “Advanced User Interfaces for Shiny Developers” at the latest 2020 virtual e-Rum conference whose detailed agenda is available here. This two hours workshop takes a lot of inspiration on this book. An RStudio Cloud dedicated project is deployed here and slides are located here.

R/Pharma 2020

This books served as resource for the 2020 R/Pharma Unleash Shiny workshop held by John Coene, Colin Fay and David Granjon. Slides are available here and exercises accessible from here. This workshop expects an higher level than the e-Rum one.

About RinteRface

The RinteRface project is an initiative aiming to provide one of the most famous HTML templates to Shiny. Everything started by the collaboration of John Coene and David Granjon early 2018 on shinybulma (Coene and Granjon 2021) to officially release RinteRface November 2018 with shinydashboardPlus (Granjon 2021d), bs4Dash (Granjon 2021a) as line-up packages.

The biggest RinteRface accomplishment is probably the work in progress shinyMobile package, which was initially called {shinyF7}, in collaboration with the dreamRs team.

Since 2019, RinteRface has been involved in various R related events like local R meetups or conferences (Zurich R User Group, baselR, useR2019, satRdayNeuchatel2020, e-Rum2020, RPharma2020).

RinteRface is a contributor in the Shiny Developers Series, hosted by Eric Nantz, also known as the theRcast.

RinteRface work has been awarded several times at the 2 latest shiny contests (2019 and 2020), through contributions like:

  • A virtual lab for teaching physiology (2019), the Apps.Physiol plateform, fuelled by bs4Dash and hosted in {CaPO4Sim} (Granjon 2021b)
The virtual patient simulator of {CaPO4Sim}

FIGURE 0.1: The virtual patient simulator of {CaPO4Sim}

{deminR}, a minesweeper for R

FIGURE 0.2: {deminR}, a minesweeper for R

RinteRface is very grateful to the R community and this book is a sort of acknowledgment!


  • I am very grateful to Douglas Robinson for proof reading the book and fixing many typos it contained.
  • A special thanks to my friends John and Victor for contributing to RinteRface.
  • Thanks to the eRum organizers for inviting me to the virtual e-Rum2020 conference.
  • RinteRface and this book won’t exist without the amazing R community. Thanks for their valuable feedback.


This book was built with R version 3.6.1 (2019-07-05) and the following packages:

package version source
apexcharter 0.1.8 CRAN (R 3.6.2)
blaze 0.0.1 Github (nteetor/blaze@0adb2ec)
blogdown 1.1 CRAN (R 3.6.2)
brochure Github (ColinFay/brochure@33a1c2f)
bs4Dash Github (RinteRface/bs4Dash@2f258dc)
bslib 0.2.4 CRAN (R 3.6.1)
CaPO4Sim Github (DivadNojnarg/CaPO4Sim@1611274)
charpente Github (RinteRface/charpente@cb9624b)
deminR Github (DivadNojnarg/deminR@e0bf665)
dplyr 1.0.3 CRAN (R 3.6.2)
fresh Github (dreamRs/fresh@bf1e00a)
ggplot2 3.3.3 CRAN (R 3.6.2)
golem 0.3.0 Github (ThinkR-open/golem@558a715)
htmltools Github (rstudio/htmltools@e7f0393)
httpuv 1.5.5 CRAN (R 3.6.2)
httr 1.4.2 CRAN (R 3.6.2)
jsonlite 1.7.2 CRAN (R 3.6.2)
jstools 0.1.0 Github (dreamRs/jstools@5689973)
magrittr 2.0.1 CRAN (R 3.6.2)
OSUICode Github (DivadNojnarg/outstanding-shiny-ui-code@8115339)
purrr 0.3.4 CRAN (R 3.6.2)
reactR 0.4.4 CRAN (R 3.6.1)
sass 0.3.1 CRAN (R 3.6.1)
scales 1.1.1 CRAN (R 3.6.2)
shiny 1.6.0 CRAN (R 3.6.2)
shiny.router 0.2.2 CRAN (R 3.6.2)
shinybulma Github (RinteRface/shinybulma@93855e2)
shinydashboard 0.7.1 CRAN (R 3.6.0)
shinydashboardPlus 2.0.0 CRAN (R 3.6.1)
shinyjs 2.0.0 CRAN (R 3.6.1)
shinylogs 0.1.7 CRAN (R 3.6.0)
shinyMobile Github (RinteRface/shinyMobile@7c9f61b)
shinyWidgets 0.5.7 CRAN (R 3.6.2)
tablerDash 0.1.5 Github (RinteRface/tablerDash@341efde)
testthat 3.0.1 CRAN (R 3.6.2)
thematic Github (rstudio/thematic@45454fa)
waiter Github (JohnCoene/waiter@d3f7aaf)
websocket 1.3.1 CRAN (R 3.6.2)