Title: | Generate Bootstrap Cards |
---|---|
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. |
Authors: | Danielle Navarro [aut, cre] |
Maintainer: | Danielle Navarro <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2025-02-14 06:12:50 UTC |
Source: | https://github.com/djnavarro/bs4cards |
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 )
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 |
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) |
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 |
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.
A "shiny.tag" object containing the HTML for the card deck
## Not run: galleries %>% cards( title = long_name, text = blurb, image = image_url, link = gallery_url ) ## End(Not run)
## Not run: galleries %>% cards( title = long_name, text = blurb, image = image_url, link = gallery_url ) ## End(Not run)
A dataset containing information describing several galleries of generative art created in R.
galleries
galleries
A tibble with 7 rows and 5 variables:
full name of the gallery
compact name of the gallery
date on which the gallery was posted
brief description of the gallery
names of R packages used to generate the art
location of the gallery thumbnail image
location of the gallery homepage