Skip to contents

What can I use cascadess for?

Change background colors

div(
  .style %>%
    background_color(theme_primary()) %>%
    border_color(theme_primary()) %>%
    padding_vertical(3)  ## to give the box some height
)

Vertically stack action buttons

div(
  .style %>%
    flex_display() %>%
    flex_direction("column") %>%
    gap_vertical(2),
  demo_button("Button 1"),
  demo_button("Button 2"),
  demo_button("Button 3")
)

Or use the stack_vertical() shortcut function.

div(
  .style %>%
    stack_vertical() %>%
    gap_vertical(2),
  demo_button("Button 1"),
  demo_button("Button 2"),
  demo_button("Button 3")
)

Adjust to the screen size

On small screens this example will look like the column of buttons above. On large screens though the buttons will display in a single row.

div(
  .style %>%
    flex_display() %>%
    flex_direction(xs = "column", md = "row") %>%
    gap_all(2),
  demo_button("Button 1"),
  demo_button("Button 2"),
  demo_button("Button 3")
)

Combine with {bslib}

# install.packages("bslib")
library(bslib)
card(
  .style %>%
    border_color(theme_info()) %>%
    text_color(theme_info()),
  "An info-styled card"
)
An info-styled card
card(
  .style %>%
    border_color("dark"),
  card_header(
    .style %>%
      background_color("dark"),
    "A header"
  ),
  card_body(
    "Some body text"
  )
)
A header
Some body text