diff --git a/content/style/shortcodes.md b/content/style/shortcodes.md index ae49b13e54..bb6eaced24 100644 --- a/content/style/shortcodes.md +++ b/content/style/shortcodes.md @@ -284,6 +284,72 @@ and `panel-id`/`panel-link` values must be unique HTML IDs on the page. +## Accordion list + +The Accordion shortcodes create a [Foundation Framework Accordion](https://get.foundation/sites/docs/accordion.html). + +To add an accordion, wrap the `accordion-list` shortcode around as many `accordion-item` shortcodes as you want. + +The following example creates an accordion list with a single list item: + +```markdown +{{}} +{{}} +Hello, world. +{{}} +{{}} +``` + +### Parameters + +The `accordion-list` shortcode has the following parameters: + +`data-multi-expand` +: Whether more than one list item can be displayed at the same time. + + Default value: `false` + +`data-allow-all-closed` +: Whether all list items can be closed at the same time. + + Default value: `false` + +The `accordion-item` shortcode has the following parameters: + +`accordion-title` +: The accordion item title. + +`is-active` +: Whether the list item is active by default. + + Default value: `false` + +### Examples + +The following example creates and accordion with two list items, the second is active by default, all items can be displayed at the same time, and both can be closed at the same time. + +```markdown +{{}} +{{}} +Hello, world. +{{}} +{{}} +This is active by default +{{}} +{{}} +``` + +Which looks like this: + +{{< accordion-list data-multi-expand="true" data-allow-all-closed="true" >}} +{{< accordion-item accordion-title="List item description" >}} +Hello, world. +{{< /accordion-item >}} +{{< accordion-item accordion-title="Active item" is-active="true" >}} +This is active by default +{{< /accordion-item >}} +{{< /accordion-list >}} + ## `highlight` shortcode You can add code examples using the `highlight` shortcode. diff --git a/content/style/test.md b/content/style/test.md index d492837169..24427794ba 100644 --- a/content/style/test.md +++ b/content/style/test.md @@ -503,6 +503,59 @@ Checklists are an unordered list with a checkbox. +### Accordions + +Basic two item accordion: + +{{< accordion-list data-multi-expand="true" data-allow-all-closed="true" >}} +{{< accordion-item accordion-title="List item description" >}} +Hello, world. +{{< /accordion-item >}} +{{< accordion-item accordion-title="Active item" is-active="true" >}} +This is active by default +{{< /accordion-item >}} +{{< /accordion-list >}} + +Accordion in an ordered list: + + + +These are procedures: + +1. Do this. + +1. Do that: + + {{< accordion-list data-multi-expand="true" data-allow-all-closed="true" >}} + {{< accordion-item accordion-title="Active item" is-active="true" >}} + This is active by default + + ```json + { + "This": "is a sample json", + "for": "markdown and Hugo testing." + } + ``` + {{< /accordion-item >}} + {{< /accordion-list >}} + +Accordion in an unordered list: + +This is a list: + +- Some text + + {{< accordion-list data-multi-expand="true" data-allow-all-closed="true" >}} + {{< accordion-item accordion-title="List item description" >}} + Hello, world. + {{< /accordion-item >}} + {{< accordion-item accordion-title="Active item" is-active="true" >}} + This is active by default + {{< /accordion-item >}} + {{< /accordion-list >}} + + + ## Code ### Code blocks