Skip to content

royfrancis/quarto-accordion

Repository files navigation

accordion build

A quarto shortcode extension to add Bootstrap accordion component for html and revealjs formats. Minimal non-interactive fallbacks are provided for other output formats pdf and typst.

See changelog.md for latest updates.

Install

  • Requires Quarto >= 1.4.0
  • In the root of the quarto project, run in terminal:
quarto add royfrancis/quarto-accordion

This will install the extension under the _extensions subdirectory.

Usage

Examples showing how to define accordion items using YAML metadata and inline shortcode arguments. Mandatory parameters are header and body. Optional parameters are collapsed (defaults to true) and id (defaults to auto-generated).

YAML metadata

---
title: Accordion
accordion:
  - accordion-1:
    - header: Click here to view contents
      body: This is the body content
      collapsed: true
      id: custom-item-1
---

{{< accordion accordion-1 >}}

Inline content

{{< accordion header="Click here to view contents" body="This is the body content" collapsed=true >}}
{{< accordion items='[{"header":"Item 1","body":"This is the body content for item 1.","collapsed":true},{"header":"Item 2","body":"This is the body content for item 2.","collapsed":true}]' >}}

For more examples and usage guide, see here.


2026 • Roy Francis