Components designed to be provided as direct children of a card()
. For a
general overview of the card()
API, see this article.
Usage
card_body(..., fill = FALSE, height = NULL, class = NULL)
card_body_fill(
...,
gap = NULL,
max_height = NULL,
max_height_full_screen = max_height,
min_height = NULL,
class = NULL
)
card_title(..., container = htmltools::h5)
card_header(..., class = NULL, container = htmltools::div)
card_footer(..., class = NULL)
card_image(
file,
...,
href = NULL,
border_radius = c("top", "bottom", "all", "none"),
mime_type = NULL,
class = NULL,
height = NULL,
width = NULL,
container = card_body_fill
)
as.card_item(x)
is.card_item(x)
Arguments
- ...
Unnamed arguments can be any valid child of an htmltools tag. Named arguments become HTML attributes on returned UI element.
- fill
whether to allow the
card_body()
to grow and shrink to fit itscard()
.- height
Any valid CSS unit (e.g.,
height="200px"
).- class
Additional CSS classes for the returned UI element.
- gap
A CSS length unit defining the
gap
(i.e., spacing) between elements provided to...
.- max_height, max_height_full_screen, min_height
Any valid CSS length unit.
- container
a function to generate an HTML element to contain the image.
- file
a file path pointing an image. The image will be base64 encoded and provided to the
src
attribute of the<img>
. Alternatively, you may set this value toNULL
and provide thesrc
yourself.- href
an optional URL to link to.
- border_radius
where to apply
border-radius
on the image.- mime_type
the mime type of the
file
.- width
Any valid CSS unit (e.g.,
width="100%"
).- x
an object to test (or coerce to) a card item.
Value
An htmltools::div()
tag.
Functions
card_body()
: A general container for the "main content" of acard()
.card_body_fill()
: Similar tocard_body(fill = TRUE)
, but also marks the return element as a "fill container" (viahtmltools::bindFillRole()
) so that its immediate children are allowed to grow and shrink to fit.card_title()
: Similar tocard_header()
but without the border and background color.card_header()
: A header (with border and background color) for thecard()
. Typically appears before acard_body()
.card_footer()
: A header (with border and background color) for thecard()
. Typically appears after acard_body()
.card_image()
: Include static (i.e., pre-generated) images.as.card_item()
: Mark an object as a card item. This will prevent thecard()
from putting the object inside awrapper
(i.e., acard_body()
).
See also
card()
for creating a card component.
navs_tab_card()
for cards with multiple tabs.
layout_column_wrap()
for laying out multiple cards (or multiple
columns inside a card).