View source: R/accordion_sidebar.R
bs_accordion_sidebar | R Documentation |
Combines Bootstrap accordion with
the functionality of shiny::[sidebarLayout][shiny::sidebarLayout]
,
allowing you to add another dimension to your shiny apps.
bs_accordion_sidebar( id, spec_side = c(width = 4, offset = 0), spec_main = c(width = 8, offset = 0), position = c("left", "right") ) use_bs_accordion_sidebar() ## S3 method for class 'bsplus_accordion_sidebar' bs_append(tag, title_side, content_side, content_main, ...) ## S3 method for class 'bsplus_accordion_sidebar' bs_set_opts( tag, panel_type_active = "success", panel_type_inactive = "primary", use_main_enclosure = TRUE, ... )
id |
character, unique id for accordion-sidebar |
spec_side |
numeric, column specification for sidebar panels |
spec_main |
numeric, column specification for main panels |
position |
character, indicates where to put the sidebar panels with respect to the main panels |
tag |
|
title_side |
character (HTML) or |
content_side |
character (HTML) or |
content_main |
character (HTML) or |
... |
other arguments (not used) |
panel_type_active |
character, indicated bootstrap type for active-panel header,
one of |
panel_type_inactive |
character, indicated bootstrap type for inactive-panel header,
one of |
use_main_enclosure |
logical, indicates if main content is to be wrapped in a Bootstrap panel |
If you use a bs_accordion_sidebar()
, you will have to call the function
use_bs_accordion_sidebar()
somewhere in your UI. This attaches some
JavaScript needed for your accordion sidebar to work properly.
All of these functions return a bsplus_accsidebar
object,
(which is also an htmltools::[tag][htmltools::tag]
, <div/>
), so you can
compose an accordion sidebar by piping. There are three parts to this system:
A constructor function for the accordion-sidebar, bs_accordion_sidebar()
A function to set options for subsequent panels, bs_set_opts()
A function to append a panel-set to an accordion-sidebar, bs_append()
The verb append is used to signify that you can append an arbitrary number of panels-sets to an accordion-sidebar.
For the constructor, bs_accordion_sidebar()
,
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.
bsplus_accsidebar
object (htmltools::[tag][htmltools::tag]
,
<div/>
)
bs_accordion_sidebar(id = "meet_the_beatles") %>% bs_append( title_side = "John Lennon", content_side = "Rhythm guitar, vocals", content_main = "Dear Prudence" ) %>% bs_append( title_side = "Paul McCartney", content_side = "Bass guitar, vocals", content_main = "Blackbird" ) ## Not run: use_bs_accordion_sidebar() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.