Agenda
Review
Themes
Plots
Value boxes
CSS
Fonts
www
Tip
As a webpage, a Shiny app is infinitely customizable in theory, but it may require CSS.
In this section, we will cover built in shortcuts and best practices.
Agenda
Review
Themes
Plots
Value boxes
CSS
Fonts
www
Shinyswatch themes are the easiest way to change the entire look of an app.
theme
Shinyswatch provides 25 bootstrap themes. Apply by name with the theme
submodule.
Agenda
Review
Themes
Plots
Value boxes
CSS
Fonts
www
And other elements that use colors, which may not match the theme?
Each theme assigns its own set of color classes to predefined names. These are available in the themes color
submodule. Set colors to these, e.g.
Tip
Use tab completion to explore the color options.
Agenda
Review
Themes
Plots
Value boxes
CSS
Fonts
www
That’s the Pareto Rule for styling Shiny apps.
But what if you want more control?
Agenda
Review
Themes
Plots
Value boxes
CSS
Fonts
www
Cascading Style Sheets (CSS) are a framework for customizing the appearance of a webpage.
Define styles in one of three places:
Assign styles to:
Use ui.include_css()
Use ui.tags.style()
Use the style=
parameter.
Agenda
Review
Themes
Plots
Value boxes
CSS
Fonts
www
Important
If you use a non-standard font in your app, provide the font to your user’s browser.
There are two methods.
Important
This is the required method if your app will be viewed offline.
Do any of our R for Shiny users know where to store files to share with the user’s browser?
Agenda
Review
Themes
Plots
Value boxes
CSS
Fonts
www
The files in your app dorectory are shared with the computer that serves your app (so it can do its job), but not with your user’s web browser.
Note
To share files with the web browser you must place them in a sub-directory named www
.
Note
If you include a sub-directory named www
, Shiny will make its contents available to the the application’s UI at /
.
This makes www
a very good place to store things needed by a browser, like: