containers: CLI containers

Description Details Examples

Description

Container elements may contain other elements. Currently the following commands create container elements: cli_div(), cli_par(), the list elements: cli_ul(), cli_ol(), cli_dl(), and list items are containers as well: cli_it().

Details

Container elements need to be closed with cli_end(). For convenience, they are have an .auto_close argument, which allows automatically closing a container element, when the function that created it terminates (either regularly, or with an error).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## div with custom theme
d <- cli_div(theme = list(h1 = list(color = "blue",
                                    "font-weight" = "bold")))
cli_h1("Custom title")
cli_end(d)

## Close automatically
div <- function() {
  cli_div(class = "tmp", theme = list(.tmp = list(color = "yellow")))
  cli_text("This is yellow")
}
div()
cli_text("This is not yellow any more")

cliapp documentation built on Oct. 23, 2020, 6:36 p.m.