Learn R Programming

bsTools (version 1.0.5)

bs_carousel: Create a Bootstrap carousel

Description

Learn more at https://getbootstrap.com/docs/5.1/components/carousel/.

Usage

bs_carousel(
  id,
  items = list(),
  carousel_attr = c(class = "carousel slide"),
  inner_attr = c(class = "carousel-inner"),
  item_attr = c(class = "carousel-item"),
  controls = TRUE
)

Value

A string of HTML.

Arguments

id

A string, the id to use for the carousel div.

items

A list, entries should be HTML to display in the carousel.

carousel_attr

A named list or named vector, names are attribute names and values are attribute values. Added to the div wrapping the carousel content.

inner_attr

A named list or named vector, names are attribute names and values are attribute values. Added to the div wrapping the carousel items.

item_attr

A named list or named vector, names are attribute names and values are attribute values. Added to the div wrapping each carousel item.

controls

TRUE/FALSE, if TRUE, adds code to display arrows to click through the carousel.

Examples

Run this code
bs_carousel(
id = "c1",
items = list(
  h1("First slide"),
  h1("Second slide"),
  h1("Third Slide")
)
)

Run the code above in your browser using DataLab