item: Flex items

Description Usage Arguments Examples

View source: R/flex.R

Description

The item() function adjusts a flex item. Unlike flex(), which adjusts the flex box layout through the flex container element, item() is used to change specific flex items. A flex item may be reordered, expanded, or shrunk.

Usage

1
2
3
4
5
6
7
8
item(
  x,
  align = "stretch",
  order = NULL,
  fill = NULL,
  grow = NULL,
  shrink = NULL
)

Arguments

x

A tag element or .style pronoun.

align

A responsive argument.

One of "auto", "start", "end", "center", "baseline", or "stretch" specifying how to align the item on the cross axis, defaults to "stretch". Overrides the flex() align argument.

order

A responsive argument.

One of 0, 1, 2, 3, 4, 5, 6, or 7 specifying the order of the item, defaults to 1. Items of the same order are then sorted by their source code order. Defaults to NULL, in which case the argument is ignored.

fill

A responsive argument.

If TRUE, the flex parent element's horizontal space is divided proportionally amongst this tag element and all other flex items with fill = TRUE, defaults to NULL, in which case the argument is ignored.

grow

A responsive argument.

One of TRUE or FALSE, defaults to NULL, in which case the argument is ignored.

shrink

A responsive argument.

One of TRUE or FALSE, defaults to NULL, in which case the argument is ignored.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(htmltools)

div(
  .style %>%
    display("flex"),
  div(
    .style %>%
      item(order = 2),
    "Second"
  ),
  div(
    "First"
  )
)

cascadess documentation built on Jan. 13, 2021, 5:10 p.m.