| style | R Documentation |
style() describes how a widget looks and how much space it takes. Only
the properties you set are stored, so styles can be layered: a widget's
built-in default style is overridden by the style passed to its
constructor, and state styles (focus, disabled, ...) are applied on
top while the widget is in that state.
style(
width = NULL,
height = NULL,
min_width = NULL,
max_width = NULL,
min_height = NULL,
max_height = NULL,
margin = NULL,
padding = NULL,
border = NULL,
border_color = NULL,
align = NULL,
valign = NULL,
wrap = NULL,
layout = NULL,
foreground = NULL,
background = NULL,
bold = NULL,
italic = NULL,
underline = NULL,
reverse = NULL,
dim = NULL,
strike = NULL,
grid_columns = NULL,
grid_rows = NULL,
grid_gap = NULL,
column_span = NULL,
row_span = NULL,
focus = NULL,
hover = NULL,
disabled = NULL,
states = NULL
)
width, height |
Size, see above. |
min_width, max_width, min_height, max_height |
Size limits in cells. |
margin, padding |
Space outside / inside the border. One value (all sides), two values (vertical, horizontal) or four values (top, right, bottom, left). |
border |
Border type: |
border_color |
Border colour (defaults to the foreground colour). |
align |
Horizontal alignment of text, or of children inside a
container: |
valign |
Vertical alignment: |
wrap |
How text that is wider than the widget is wrapped: |
layout |
How a container arranges its children: |
foreground, background |
Text and background colours. |
bold, italic, underline, reverse, dim, strike |
Text attributes. |
grid_columns, grid_rows |
Grid tracks for |
grid_gap |
Space between grid cells: one value, or |
column_span, row_span |
How many grid cells a child occupies. |
focus, hover, disabled |
Styles applied while the widget has focus, is under the mouse pointer, or is disabled. |
states |
A named list of styles for other widget states, e.g.
|
width and height accept:
a number: a fixed number of cells;
"auto": the natural size of the content;
"<n>fr": a share of the remaining space (e.g. "1fr", "2fr");
"<n>%": a percentage of the parent's content area.
foreground, background and border_color accept ANSI names
("red", "bright_blue", "grey"), integers 0-255 (xterm palette),
hex strings ("#ff8700") and R colour names ("steelblue").
An object of class termr_style.
style(width = 20, padding = c(0, 1), border = "round",
foreground = "white", background = "blue", bold = TRUE,
focus = style(background = "bright_blue"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.