Builds a deck of bootstrap cards
cards(
data,
title = NULL,
text = NULL,
image = NULL,
link = NULL,
footer = NULL,
header = NULL,
tags = NULL,
layout = "label-below",
width = 3,
spacing = 2,
breakpoint = 4,
label_colour = NULL,
border_colour = NULL,
border_width = 1,
border_radius = 3
)
Data frame
Title for the card
Text for the card
Path to the card image
URL to link to from title and image
Card footer
Card header
Tags to be assigned to each card
Card layout is a string, defaults to "label-below" (see details)
Card width is an integer between 1 and 5
Spacing between cards is an integer between 0 and 5
Number between 1 and 5, controlling label size on horizontal and inset layouts
Colour applied to the card label (if NULL, colour inherits)
Colour applied to the card border (if NULL, colour inherits)
Width of card border is an integer between 0 and 5
Amount of rounding on card corners is an integer between 0 and 5
This function constructs the HTML necessary to specify a deck of bootstrap 4 cards suitable for inclusion within an R markdown document. It takes a data frame as the first argument, with one row for each card to be generated.
Cards are specified using the title
, text
, image
,
link
, footer
, header
, and tags
arguments. These
arguments take expressions to be evaluated using the user-supplied
data
, and should evaluate to character vectors that have length 1 or
the same number of rows as data
.
The layout
argument is a single character string specifying the
layout of the cards: possible values are "label-below" (the default),
"label-above", "label-left", "label-right", "label-only", "image-only",
"inset-top", "inset-bottom".
The width
, spacing
, breakpoint
, border_width
,
and border_radius
arguments all take integer inputs specifying
the visual appearance of the cards. Allowed values range from 0 to 5, except
for width
and breakpoint
which cannot be 0. The other two
arguments label_colour
and border_colour
take a single string
specifying colours of the relevant parts of the card.
if (FALSE) {
galleries %>%
cards(
title = long_name,
text = blurb,
image = image_url,
link = gallery_url
)
}