layout_column_wrap {bslib} | R Documentation |
Column-first uniform grid layouts
Description
Wraps a 1d sequence of UI elements into a 2d grid. The number of columns (and
rows) in the grid dependent on the column width
as well as the size of the
display. For more explanation and illustrative examples, see the References
section below.
Usage
layout_column_wrap(
...,
width = "200px",
fixed_width = FALSE,
heights_equal = c("all", "row"),
fill = TRUE,
fillable = TRUE,
height = NULL,
height_mobile = NULL,
min_height = NULL,
max_height = NULL,
gap = NULL,
class = NULL
)
Arguments
... |
Unnamed arguments should be UI elements (e.g., |
width |
The desired width of each card, which can be any of the following:
|
fixed_width |
When |
heights_equal |
If |
fill |
Whether or not to allow the layout to grow/shrink to fit a
fillable container with an opinionated height (e.g., |
fillable |
Whether or not each element is wrapped in a fillable container. |
height |
Any valid CSS unit (e.g.,
|
height_mobile |
Any valid CSS unit to use for the height when on mobile devices (or narrow windows). |
min_height , max_height |
The maximum or minimum height of the layout container.
Can be any valid CSS unit (e.g.,
|
gap |
A CSS length unit defining the
|
class |
Additional CSS classes for the returned UI element. |
References
The bslib website features layout_column_wrap()
in two places:
See Also
Other Column layouts:
layout_columns()
Examples
x <- card("A simple card")
# Always has 2 columns (on non-mobile)
layout_column_wrap(width = 1/2, x, x, x)
# Automatically lays out three cards into columns
# such that each column is at least 200px wide:
layout_column_wrap(x, x, x)
# To use larger column widths by default, set `width`.
# This example has 3 columns when the screen is at least 900px wide:
layout_column_wrap(width = "300px", x, x, x)
# You can add a list of items, spliced with rlang's `!!!` operator
layout_column_wrap(!!!list(x, x, x))