Package ‘bs4cards’
October 12, 2022
Title Generate Bootstrap Cards
Version 0.1.1
Description Allows the user to generate bootstrap cards within
R markdown documents. Intended for use in conjunction with
R markdown HTML outputs and other formats that support the
bootstrap 4 library.
License MIT + file LICENSE
Encoding UTF-8
LazyData true
Imports htmltools, magrittr, methods, rlang
URL https://github.com/djnavarro/bs4cards
BugReports https://github.com/djnavarro/bs4cards/issues
Suggests testthat (>= 3.0.0), knitr, rmarkdown, tibble, covr, bslib
RoxygenNote 7.1.1
Depends R (>= 2.10)
Config/testthat/edition 3
NeedsCompilation no
Author Danielle Navarro [aut, cre] (<https://orcid.org/0000-0001-7648-6578>)
Maintainer Danielle Navarro <[email protected]>
Repository CRAN
Date/Publication 2021-11-30 08:10:02 UTC
R topics documented:
cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
galleries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Index 5
1
2 cards
cards Builds a deck of bootstrap cards
Description
Builds a deck of bootstrap cards
Usage
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
)
Arguments
data Data frame
title Title for the card
text Text for the card
image Path to the card image
link URL to link to from title and image
footer Card footer
header Card header
tags Tags to be assigned to each card
layout Card layout is a string, defaults to "label-below" (see details)
width Card width is an integer between 1 and 5
spacing Spacing between cards is an integer between 0 and 5
breakpoint Number between 1 and 5, controlling label size on horizontal and inset layouts
label_colour Colour applied to the card label (if NULL, colour inherits)
galleries 3
border_colour Colour applied to the card border (if NULL, colour inherits)
border_width Width of card border is an integer between 0 and 5
border_radius Amount of rounding on card corners is an integer between 0 and 5
Details
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 val-
ues 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 inte-
ger inputs specifying the visual appearance of the cards. Allowed values range from 0 to 5, ex-
cept 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.
Value
A "shiny.tag" object containing the HTML for the card deck
Examples
## Not run:
galleries %>%
cards(
title = long_name,
text = blurb,
image = image_url,
link = gallery_url
)
## End(Not run)
galleries Generative art galleries
Description
A dataset containing information describing several galleries of generative art created in R.
Usage
galleries
4 galleries
Format
A tibble with 7 rows and 5 variables:
long_name full name of the gallery
short_name compact name of the gallery
date date on which the gallery was posted
blurb brief description of the gallery
paintbrushes names of R packages used to generate the art
image_url location of the gallery thumbnail image
gallery_url location of the gallery homepage
Source
https://art.djnavarro.net/
Index
datasets
galleries, 3
cards, 2
galleries, 3
5