library("htmltools")
library("bsplus")

A carousel can be useful to cycle through slides with related content. There like the accordion, there are two main functions:

The content and caption arguments can be composed using the helper functions bs_carousel_image(), which returs a centered-image tag, and bs_carousel_caption() with text arguments title and body.

bs_carousel(id = "the_beatles", use_indicators = TRUE) %>%
  bs_append(
    content = bs_carousel_image(src = "img/john.jpg"),
    caption = bs_carousel_caption("John Lennon", "Rhythm guitar, vocals")
  ) %>%
  bs_append(
    content = bs_carousel_image(src = "img/paul.jpg"),
    caption = bs_carousel_caption("Paul McCartney", "Bass guitar, vocals")
  ) %>%
  bs_append(
    content = bs_carousel_image(src = "img/george.jpg"),
    caption = bs_carousel_caption("George Harrison", "Lead guitar, vocals")
  ) %>%
  bs_append(
    content = bs_carousel_image(src = "img/ringo.jpg"),
    caption = bs_carousel_caption("Ringo Starr", "Drums, vocals")
  ) 

Here's another rendering of the carousel, this time:

bs_carousel(id = "with_the_beatles") %>%
  bs_set_data(interval = FALSE) %>%
  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")) 

Reference

For more information, please see the Bootstrap JavaScript page.



ijlyttle/bsplus documentation built on Nov. 15, 2022, 2:31 a.m.