A Payload site, ready to clone

FAQ block

Questions that open to show their answers, with no JavaScript.

What it does

The FAQ block lists questions; each one opens to show its answer and closes again. The browser does it with its own disclosure element, so it works by mouse, touch and keyboard, without JavaScript, and even without the site’s styles.

The editor chooses how the questions open: each on its own, so several can be open at once, or one at a time, so opening a question closes the one that was open. Another switch opens the first question when the page loads.

An answer is a list of blocks, like a column: it starts with an empty text block, and takes an image with text, a video, a call to action or any block a column takes, never another FAQ.

See it in the demo

Below, the first FAQ opens each question on its own and starts with the first one open; its second answer holds a text and a call to action. The second FAQ, on an accent band, opens one question at a time. Press Tab to reach a question, then Enter or Space to open or close it. In the visual editor, each answer is a block list: add a block into it, or drag one in.

For developers

apex-block-base 0.24.0 ships it as createFaq({ blocks }), a factory like createColumns: template-site passes the blocks an answer takes, those a column takes plus the ones a block package lists under inFaq. One at a time gives the block’s details elements one name (the exclusive accordion of HTML). No FAQPage structured data for now.

Frequently asked questions

How do the questions open?

Each on its own here: open several and they stay open. The first one starts open, an option of the block.

Can an answer hold more than text?

Yes. An answer is a list of blocks, like a column, so this one ends with a call to action.

Edit it on the page

Each answer is a block list in the visual editor.

About editing
Does it need JavaScript?

No. The browser opens and closes each question itself, so it works with JavaScript off, and without the site’s styles it is still a list of questions that open.

One at a time

What happens when I open this one?

The question that was open closes: only one shows its answer.

And this one?

The same: opening it closed the one before.

Without JavaScript too?

Yes: the browser groups the questions by a name the block gives them.

One block, every feature page

This strip is a reusable block: written once and placed at the end of every feature page. Edit it under Reusable blocks and all of them change.

All features