# install.packages('pak')
::pak('mjfrigaard/shinypak')
paklibrary(shinypak)
Code
Expand the boxes below to review what was covered in previous three chapters:
Shiny simplifies the creation of interactive web applications by allowing you to write R code that is automatically translated into HTML, CSS and JavaScript. However, sometimes it’s necessary to include non-R code files as supplemental resources to improve your application. This section will cover how to include HTML, CSS, and JavaScript files in a Shiny app-package.
Application upgrades
This section also introduces a few upgrades to the Shiny application in shinyrPkgs
:
- The layout has been upraded to the
page_navbar()
frombslib
- The UI outputs now sit in
nav_panel()
s, with collapsible sidebars and footers.1 - The scatter-plot tab includes a table display of the movies data using the
reactable
package.
- The UI outputs now sit in
- Improved plots
- We’re using
rlang
’s injection operator (!!
) for the plot inputs (instead of the.data
masking), so the plotting modules now contain theggplot2
functions used to create the graphs.
- A new plot label formatting function (
label_titler()
) makes it easier to convert variable inputs into title case.
- We’re using
- New graphs for viewing metrics by year and distributions
HTML
In HTML chapter, we’ll explore how to embed HTML within Shiny apps, use tags and functions to enhance UI layouts, and leverage HTML templates for more complex designs.
Additionally, we’ll cover how to seamlessly combine Shiny’s reactive outputs with custom HTML elements to build interactive interfaces.
CSS
The CSS chapter delves into the art of styling your Shiny applications, ensuring they are both visually appealing and user-friendly. We discuss how to apply custom styles to your app using CSS, enabling you to customize the appearance of your elements beyond Shiny’s default themes. You’ll learn how to include external CSS files, write inline styles, and utilize CSS frameworks like Bootstrap for responsive design. Through practical examples, we demonstrate how to manage CSS specificity, create reusable styles, and enhance the overall user experience by controlling layout, typography, colors, and animations.
JavaScript
In the JavaScript chapter, we cover how to extend the functionality of your Shiny applications with custom JavaScript. JavaScript can be used to handle client-side interactivity, manipulate the DOM, and integrate third-party libraries and APIs. We’ll show you how to include JavaScript files in your Shiny app-package, write custom JavaScript code that interacts with Shiny’s reactive model, and use Shiny’s JavaScript functions to create more dynamic and responsive applications. This chapter equips you with the skills to bridge the gap between Shiny’s R-based framework and the extensive capabilities of JavaScript, enhancing your app’s performance and user interaction.
Style
Style covers formatting the code in your package so it’s easier to debug (and read).
bslib
uses cards to display contents inside eachnav_panel()
. The outputs usecard()
withlayout_sidebar()
,card_body()
, andcard_footer()
. Learn more on thebslib
website.↩︎