Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nteetor/cascadess

A style pronoun for {htmltools} tags
https://github.com/nteetor/cascadess

bootstrap-5 css r shiny

Last synced: about 1 month ago
JSON representation

A style pronoun for {htmltools} tags

Awesome Lists containing this project

README

        

# cascadess

[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
![r-cmd-check](https://github.com/nteetor/cascadess/workflows/r-cmd-check/badge.svg)
[![codecov](https://codecov.io/gh/nteetor/cascadess/branch/main/graph/badge.svg)](https://codecov.io/gh/nteetor/cascadess)
[![CRAN status](https://www.r-pkg.org/badges/version/cascadess)](https://CRAN.R-project.org/package=cascadess)

A style pronoun and utilities for {[htmltools](https://github.com/rstudio/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")`.

``` R
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.

``` R
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.

``` R
install.packages("cascadess")
```

The development version may be installed from the main branch.

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