| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/ornament.R |
| 3 |
\name{new_ornament} |
| 4 |
\alias{new_ornament} |
| 5 |
\title{Helper to define the contents of a pillar} |
| 6 |
\usage{ |
| 7 |
new_ornament(x, width = NULL, align = NULL) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{A character vector with formatting, |
| 11 |
can use ANYI styles e.g provided by the \pkg{cli} package.} |
| 12 |
|
| 13 |
\item{width}{An optional width of the resulting pillar, computed from \code{x} if |
| 14 |
missing} |
| 15 |
|
| 16 |
\item{align}{Alignment, one of \code{"left"} or \code{"right"}} |
| 17 |
} |
| 18 |
\description{ |
| 19 |
This function is useful if your data renders differently depending on the |
| 20 |
available width. In this case, implement the \code{\link[=pillar_shaft]{pillar_shaft()}} method for your |
| 21 |
class to return a subclass of "pillar_shaft" and have the \code{\link[=format]{format()}} method |
| 22 |
for this subclass call \code{new_ornament()}. See the implementation of |
| 23 |
\code{pillar_shaft.numeric()} and \code{format.pillar_shaft_decimal()} for an example. |
| 24 |
} |
| 25 |
\examples{ |
| 26 |
new_ornament(c("abc", "de"), align = "right") |
| 27 |
} |