cascadess

Lifecycle: maturing r-cmd-check codecov CRAN status

A style pronoun and utilities for {htmltools} tags, {bslib}, and {shiny}.

What can I use cascadess for?

Importantly, cascadess’s styles can be used with any shiny related package. The styles applied by cascadess are based upon the Bootstrap CSS framework. So, rather than conflict, the applied styles are designed to blend with those applied by bslib.

Why a pronoun?

Cascadess defines a style pronoun, .style, usable inside htmltools::tags HTML builder functions. With .style you can specify styling directly within a function call to help a reader understand how the HTML tag element will be styled. Without the .style pronoun, styling is applied after a function call.

input_button(
  .style |>
    margin_all(2) |>
    background_color("primary"),
  id = "go",
  label = "Go!"
)

# vs

input_button(
  id = "go",
  label = "Go!"
) |>
  margin_all(2) |>
  background_color("primary")

Usage

To see the CSS styles, either include a call to cascadess_dependencies() somewhere in the UI of the application or use the bslib package.

div(
  cascadess_dependencies(),
  div(
    .style |>
      margin_all(3) |>
      shadow("lg"),
    "For a standalone report or simple shiny app"
  )
)
page(
  card(
    .style |>
      margin_all(3) |>
      border_color(theme_info()) |>
      font_color(theme_info()),
    "When using bslib, the necessary CSS styles are already included"
  )
)

Installation

Install the package from CRAN with,

install.packages("cascadess")