containers {cli}R Documentation

CLI containers

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_li().

Details

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

Examples

## 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")

[Package cli version 3.0.1 Index]