Accordion

Description

A vertically stacked set of collapsible sections built on native <details> elements.

Usage

bc_accordion(..., id = NULL, multiple = FALSE, class = NULL)

bc_accordion_item(
  title,
  ...,
  open = FALSE,
  disabled = FALSE,
  id = NULL,
  icon = NULL
)

Arguments

Argument Description
... Accordion items. Tags pass through and lists are passed to bc_accordion_item() with title, content, open and disabled.
id String. The ID for the accordion root.
multiple Bool. Allow more than one item open at a time. Off by default, so opening one item closes the others.
class String. Extra classes for the accordion root.
title String. The item's trigger, always visible.
open Bool. Whether the item starts open.
disabled Bool. Whether the item can be toggled.
icon Tag. Replaces the caret in the summary, such as one from the phosphoricons package. NULL for the default.

Value

A <section class="accordion"> of <details> items.

Examples

bc_accordion(
  bc_accordion_item("First section", "First section content.", open = TRUE),
  bc_accordion_item("Second section", "Second section content.")
)
First section
First section content.
Second section
Second section content.