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

bs_collapse

Collapsible element


Description

This is useful for content that you may wish to be hidden when the page is initialized, but that can be revealed (and subsequently hidden) by clicking a button or a link.

Usage

bs_collapse(id, content = NULL, show = FALSE)

bs_attach_collapse(tag, id_collapse)

Arguments

id

character, unique id for the collapsible <div/>

content

character (HTML) or htmltools::[tagList][htmltools::tagList], content for the collapsible <div/>

show

logical, indicates if collapsible <div/> is shown when page is initialized

tag

htmltools::[tag][htmltools::tag], button or link to which to attach a collapsible <div/>

id_collapse

character, id of the collapsible <div/> to attach

Details

There are two parts to this system:

  1. A collapsible <div/>, created using bs_collapse()

  2. At least one button (<button/>) or link (<a/>) to which the id of the collapsible <div/> is attached, using bs_attach_collapse()

The verb attach is used to signify that we are attaching the id of our collapsible <div/> to the tag in question (a button or a link). Note that you can attach the id of a collapsible <div/> to more than one button or link.

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

bs_collapse()

htmltools::[tag][htmltools::tag], <div/>

bs_attach_collapse()

htmltools::[tag][htmltools::tag], modified copy of tag (button or link)

See Also

Examples

library("htmltools")

bs_collapse(id = "id_yeah", "Yeah Yeah Yeah")

bs_button("She Loves You", button_type = "primary") %>%
  bs_attach_collapse("id_yeah")

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.