Skip to content

Commit 38c9eba

Browse files
committed
Document how accordion shortcodes work
Signed-off-by: Ian Maddaus <[email protected]>
1 parent 27d6b8d commit 38c9eba

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

content/style/shortcodes.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,72 @@ and `panel-id`/`panel-link` values must be unique HTML IDs on the page.
284284

285285
<!-- markdownlint-enable MD046 MD032 -->
286286

287+
## Accordion list
288+
289+
The Accordion shortcodes create a [Foundation Framework Accordion](https://get.foundation/sites/docs/accordion.html).
290+
291+
To add an accordion, wrap the `accordion-list` shortcode around as many `accordion-item` shortcodes as you want.
292+
293+
The following example creates an accordion list with a single list item:
294+
295+
```markdown
296+
{{</* accordion-list */>}}
297+
{{</* accordion-item accordion-title="List item description" */>}}
298+
Hello, world.
299+
{{</* /accordion-item */>}}
300+
{{</* /accordion-list */>}}
301+
```
302+
303+
### Parameters
304+
305+
The `accordion-list` shortcode has the following parameters:
306+
307+
`data-multi-expand`
308+
: Whether more than one list item can be displayed at the same time.
309+
310+
Default value: `false`
311+
312+
`data-allow-all-closed`
313+
: Whether all list items can be closed at the same time.
314+
315+
Default value: `false`
316+
317+
The `accordion-item` shortcode has the following parameters:
318+
319+
`accordion-title`
320+
: The accordion item title.
321+
322+
`is-active`
323+
: Whether the list item is active by default.
324+
325+
Default value: `false`
326+
327+
### Examples
328+
329+
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.
330+
331+
```markdown
332+
{{</* accordion-list data-multi-expand="true" data-allow-all-closed="true" */>}}
333+
{{</* accordion-item accordion-title="List item description" */>}}
334+
Hello, world.
335+
{{</* /accordion-item */>}}
336+
{{</* accordion-item accordion-title="Active item" is-active="true" */>}}
337+
This is active by default
338+
{{</* /accordion-item */>}}
339+
{{</* /accordion-list */>}}
340+
```
341+
342+
Which looks like this:
343+
344+
{{< accordion-list data-multi-expand="true" data-allow-all-closed="true" >}}
345+
{{< accordion-item accordion-title="List item description" >}}
346+
Hello, world.
347+
{{< /accordion-item >}}
348+
{{< accordion-item accordion-title="Active item" is-active="true" >}}
349+
This is active by default
350+
{{< /accordion-item >}}
351+
{{< /accordion-list >}}
352+
287353
## `highlight` shortcode
288354

289355
You can add code examples using the `highlight` shortcode.

0 commit comments

Comments
 (0)