ui.R and template.html

The ui.R is incredibly simple, and looks like this:

htmlTemplate("template.html")

That's it! You are just telling Shiny what the HTML file is called. Remember that we called it template.html. Simple. Now, the real work is done with the HTML file.

Let's look at the HTML file's various sections. First, the head:

<html>  <head>  {{ headContent() }}  {{ bootstrapLib() }}  </head>

The first thing to note is how the file will be written. Essentially, it will be HTML, interspersed with Shiny code wrapped in double curly braces. So, this first section opens the html tag and the head tag and then runs two functions, which are given inside double curly braces. You always need to include headContent(), which places the boilerplate ...

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.