Skip to content

nteetor/cascadess

Repository files navigation

cascadess

Lifecycle: maturing r-cmd-check codecov CRAN status

A style pronoun and utilities for {htmltools} tags.

What can I use cascadess for?

  • Change background color
  • Vertically stack action buttons
  • Optimize control panel layout for smaller screens
  • Affix an element to the top of the webpage
  • Increase or decrease space between html elements
  • Force text to upper, lower, or title case

Most importantly, cascadess's styles can be used with any shiny related package and are designed to not clash with or overwrite existing CSS styles.

Why a pronoun?

Cascadess defines a style pronoun, .style, usable inside htmltools::tags HTML builder functions. With .style you can specify styling directly within the builder function call, which helps the reader immediately understand how the HTML tag element is styled. Without the .style pronoun, styling is applied after the function call, e.g div() %>% margin_all(2) %>% background_color("primary").

library(htmltools)
library(cascadess)

div(
  .style %>%
    margin_all(2) %>%
    border_color("dark") %>%
    shadow("medium"),
  p("Fusce sagittis, libero non molestie mollis, magna",
    "orci ultrices dolor, at vulputate neque nulla lacinia eros.")
)

Usage

The cascadess() function must be included in a UI so the necessary CSS files are found.

ui <- list(
  cascadess(),
  h4(
    .style %>%
      font_transform("uppercase") %>%
      border_bottom("danger"),
    "Etiam vel tortor sodales tellus ultricies commodo."
  )
)

Installation

The stable version may be installed from CRAN.

install.packages("cascadess")

The development version may be installed from the main branch.

## install.packages("remotes")
remotes::install_github("nteetor/cascadess")