Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bs_carousel

Carousel


Description

A carousel is used to enclose a set of (typically) images, providing controls to move slides back-and-forth.

Usage

## S3 method for class 'bsplus_carousel'
bs_append(tag, content, caption = NULL, ...)

bs_carousel(id, use_indicators = FALSE, use_controls = TRUE)

Arguments

tag

htmltools::[tag][htmltools::tag], carousel <div/> to which to append a panel

content

character (HTML) or htmltools::[tagList][htmltools::tagList], content for the slide

caption

character (HTML) or htmltools::[tagList][htmltools::tagList], caption for the slide

...

other args (not used)

id

character, unique id for accordion <div/>, also serves as root id for slides appended using bs_append()

use_indicators

logical, denotes use of slide-position indicators (dots)

use_controls

logical, denotes use of controls (chevrons at sides)

Details

All of these functions return a bsplus_carousel object (which is also an htmltools::[tag][htmltools::tag], <div/>), so you can compose a carousel by piping. There are two parts to this system:

  1. A constructor function for the carousel, bs_carousel()

  2. A function to append a slide to the carousel, bs_append()

The verb append is used to signify that you can append an arbitrary number of slides to a carousel.

For the constructor, bs_carousel(), it is your responsibility to ensure that id is unique among HTML elements in your page. If you have non-unique id's, strange things may happen to your page.

Value

bsplus_carousel object (htmltools::[tag][htmltools::tag], <div/>)

See Also

Examples

bs_carousel(id = "with_the_beatles") %>%
  bs_append(content = bs_carousel_image(src = "img/john.jpg")) %>%
  bs_append(content = bs_carousel_image(src = "img/paul.jpg")) %>%
  bs_append(content = bs_carousel_image(src = "img/george.jpg")) %>%
  bs_append(content = bs_carousel_image(src = "img/ringo.jpg"))

bsplus

Adds Functionality to the R Markdown + Shiny Bootstrap Framework

v0.1.2
MIT + file LICENSE
Authors
Ian Lyttle [aut, cre, cph] (<https://orcid.org/0000-0001-9962-4849>), Schneider Electric [cph], Alex Shum [ctb], Emily Bosak [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.