---
title: "Templates"
format:
  html:
    # Keep the installed vignettes small (the pkgdown site applies the full theme)
    minimal: true
brand: false
vignette: >
  %\VignetteIndexEntry{Templates}
  %\VignetteEngine{quarto::html}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

This vignette provides an overview of the templates available in the `rbranding` package. Use the `get_template()` function to install the template of your choice by specifying the `template_name` argument.

::: {.callout-warning}
## Known issue on Windows

Templates that build a theme from `_brand.yml` with `bslib::bs_theme(brand = TRUE)` (`shiny_basic`, `shiny_kmeans`, `shiny_wastewater`, `quarto_website`, and `quarto_ggplot2`) download the brand's Google Fonts (`source: google`). On Windows this can fail with `Failed to open file ... font?kit=...` because of a bug in the sass package ([rstudio/sass#157](https://github.com/rstudio/sass/issues/157)). Until it is fixed, remove or replace the Google font entries under `typography` in your `_brand.yml` when running these templates on Windows.
:::


## Quarto Templates

### `quarto_website`: Simple Quarto Website Template

![](vignette-screenshots/qwebsite.jpg){width="50%" fig-alt="Screenshot of a simple branded Quarto website"}

``` r
get_template("quarto_website")
```

Provides a basic structure for a Quarto website with multiple pages, navigation, and branding support.


### `quarto_ggplot2`: Quarto Report with Branded `ggplot2` Figures
![](vignette-screenshots/qggplot2.jpg){width="50%" fig-alt="Screenshot of a branded ggplot2 scatterplot figure"}

``` r
get_template("quarto_ggplot2")
```

Provides a Quarto report setup that integrates `_brand.yml` and `ggplot2` for creating branded visualizations.


## Shiny App Templates

### `shiny_basic`: Simple Histogram Visualization Shiny App
![](vignette-screenshots/shiny2.jpg){width="50%" fig-alt="Screenshot of a simple branded Shiny app histogram"}

``` r
get_template("shiny_basic")
shiny::runApp(".")
```

Provides a simple Shiny app that allows users to interactively adjust parameters and see the results in a histogram.


### `shiny_kmeans`: Simple K-means Clustering Visualization Shiny App

![](vignette-screenshots/kmeans.jpg){width="50%" fig-alt="Screenshot of a simple branded Shiny app K-means clustering visualization"}

``` r
get_template("shiny_kmeans")
shiny::runApp(".")
```

Provides a simple Shiny app that demonstrates K-means clustering with interactive controls for the number of clusters and points. Based on [this example](https://shiny.rstudio.com/gallery/kmeans-example.html)


### `shiny_complex`: Complex Histogram Visualization Shiny App
![](vignette-screenshots/shinyapp.jpg){width="50%" fig-alt="Screenshot of a complex branded Shiny app histogram"}

``` r
get_template("shiny_complex")
shiny::shinyAppFile("app.R")
```

Provides a more complex Shiny app with multiple tabs, allowing users to interactively adjust parameters and view results in different formats.


### `shiny_wastewater`: Wastewater Data Visualization Shiny App

![](vignette-screenshots/wastewater.jpg){width="50%" fig-alt="Screenshot of a complex branded Shiny app visualizing wastewater data"}

``` r
get_template("shiny_wastewater")
shiny::runApp(".")
```

Provides a Shiny app template for visualizing wastewater data, including interactive plots and data tables. This example demonstrates how to integrate branding with the [`linkeR`](https://CRAN.R-project.org/package=linkeR) package.


## Other Templates

### `rmarkdown`: R Markdown Template for PDF or HTML Reports

![](vignette-screenshots/rmark.jpg){width="50%" fig-alt="Screenshot of a simple branded R Markdown document"}

``` r
get_template("rmarkdown")
```

Provides a basic R Markdown document setup that integrates `_brand.yml` for consistent branding in your reports.