Skip to contents

The stack_vertical() and stack_horizontal() functions are shortcuts for creating vertical and horizontal flex layouts.

Usage

stack_vertical(x)

stack_horizontal(x)

Arguments

x

A tag element or .style pronoun.

Value

An object of the same type as x.

Examples


library(htmltools)

div(
  .style %>%
    stack_vertical() %>%
    gap_all(3),
  p(
    .style %>%
      border_all() %>%
      padding_all(2),
    "First item"
  ),
  p(
    .style %>%
      border_all() %>%
      padding_all(2),
    "Second item"
  ),
  p(
    .style %>%
      border_all() %>%
      padding_all(2),
    "Third item"
  )
)
#> <div class="vstack gap-3">
#>   <p class="border p-2">First item</p>
#>   <p class="border p-2">Second item</p>
#>   <p class="border p-2">Third item</p>
#> </div>