---
title: "Accordion List (FAQ) Module for Sanity"
description: "An accordion list module for FAQs and collapsible content, with vertical or horizontal layout and schema.org FAQ markup."
---

# Accordion list module

Collapsible items for FAQs and other details readers can expand on demand. Can output FAQPage schema.org markup for rich search results.

[View source on GitHub](https://github.com/nuotsu/sanitypress/tree/main/src/modules/accordion-list) (schema + React component)

## Module fields

| Field | Type | Description |
| --- | --- | --- |
| `eyebrow` | string | Small label shown above the intro. |
| `intro` | Portable Text | Heading and copy. Centered above the items in `vertical` layout, sticky beside them in `horizontal` layout. |
| `ctas` | array of `cta` | Call-to-actions below the intro. |
| `accordions` | array of `accordion` | The collapsible items. See accordion fields below. |
| `exclusive` | boolean | Only one item can be open at a time. Defaults to `false`. |
| `enableSchema` | boolean | Outputs FAQPage schema.org JSON-LD from the items. Defaults to `true`. |
| `layout` | `vertical` \| `horizontal` | Defaults to `vertical` (stacked). `horizontal` places the intro beside the items on desktop. |
| `attributes` | `module-attributes` | Shared by every module: `uid` (HTML id for deep links), `hidden`, and `scopedCss`. |

## Accordion fields

| Field | Type | Description |
| --- | --- | --- |
| `summary` | string | Required. The always-visible question or label. |
| `content` | Portable Text | The answer, revealed when expanded. |
| `open` | boolean | Expanded by default. |

## Demo: Vertical layout

Items stack below a centered intro. `exclusive` is on, so only one item opens at a time.

### Why should I use HTML details and summary elements instead of building accordions with <div>s and JavaScript?

HTML [`<details>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details) [and](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details) [`<summary>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details) [elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details) provide native collapsible functionality without requiring JavaScript, offering better performance and accessibility out of the box. They include built-in keyboard navigation, screen reader support, and semantic meaning that assistive technologies understand. Our accordion module leverages these semantic elements while adding enhanced content management capabilities through Sanity's rich text editor, consistent cross-browser styling, and structured schema.org markup generation for better SEO.

### Does the accordion component provide any SEO benefits for content organization?

The module includes automatic [schema.org markup](https://schema.org/FAQPage) generation for FAQ-structured content when enabled, which can improve search result visibility through rich snippets. All accordion content remains accessible to search engine crawlers regardless of collapsed state, ensuring no content is hidden from indexing. The structured markup also helps search engines better understand content relationships.

### Can I control the expansion behavior to prevent multiple sections from being open simultaneously?

Yes, the **exclusive** option creates a mutually exclusive expansion pattern where opening one section automatically closes others. This is useful for content that benefits from focused attention or when you want to maintain a compact vertical layout. The default behavior allows multiple sections to remain open for comparison purposes.

### Any available layout options?

Choose either a **vertical** (stacked) or **horizontal** (side-by-side) layout.

## Demo: Horizontal layout

The intro sticks beside the items on desktop.

### Why should I use HTML details and summary elements instead of building accordions with <div>s and JavaScript?

HTML [`<details>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details) [and](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details) [`<summary>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details) [elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details) provide native collapsible functionality without requiring JavaScript, offering better performance and accessibility out of the box. They include built-in keyboard navigation, screen reader support, and semantic meaning that assistive technologies understand. Our accordion module leverages these semantic elements while adding enhanced content management capabilities through Sanity's rich text editor, consistent cross-browser styling, and structured schema.org markup generation for better SEO.

### Does the accordion component provide any SEO benefits for content organization?

The module includes automatic [schema.org markup](https://schema.org/FAQPage) generation for FAQ-structured content when enabled, which can improve search result visibility through rich snippets. All accordion content remains accessible to search engine crawlers regardless of collapsed state, ensuring no content is hidden from indexing. The structured markup also helps search engines better understand content relationships.

### Can I control the expansion behavior to prevent multiple sections from being open simultaneously?

Yes, the **exclusive** option creates a mutually exclusive expansion pattern where opening one section automatically closes others. This is useful for content that benefits from focused attention or when you want to maintain a compact vertical layout. The default behavior allows multiple sections to remain open for comparison purposes.

### Any available layout options?

Choose either a **vertical** (stacked) or **horizontal** (side-by-side) layout.

Previous module

![Blog post list module](https://cdn.sanity.io/images/cyu7k2r0/production/3c4a12acfd995d697a105959910099066188251d-2560x1136.png)

[Blog post list module](/modules/blog-post-list)

Next module

![Callout module](https://cdn.sanity.io/images/cyu7k2r0/production/0c7dfd30dc428eb4dd22ab1c08eb19b954a99ecf-2560x468.png)

[Callout module](/modules/callout)
