Etch component
FAQ Item 1
One FAQ question with a rich answer slot or sanitized HTML from a normalized loop item.
Documentation
One question and its answer, for MAC FAQ Accordion 1. The question is a button that opens and closes the answer.
How to use it
- Set Question, and put the answer in the
answerslot, which takes any content: text, lists, links or images. - In a loop, pass the answer as HTML in Answer HTML instead. It's sanitized, so scripts and unsafe markup are removed.
- In a loop over posts whose item is named
item, set Question to{item.title}and Answer HTML to{item.content}, the post's content as written in the editor. - For an ACF field, such as a WYSIWYG field named
answer, use{item.acf.answer}. For a custom field (post meta) namedanswer, use{item.meta.answer}. - Icon swaps the chevron.
Good to know
- Use it inside MAC FAQ Accordion 1: the accordion's script opens and closes the answers, and together they form a description list (
dl,dtanddd). {item.acf.answer}gives the field as ACF formats it, with paragraphs added, and{item.meta.answer}gives the value as it's stored.- The demo shows an item with its answer in the slot, then three from a loop over a JSON list on the hub, with Question
{item.question}and Answer HTML{item.answer}. Copy JSON gives the first item only.
Reference
Read from the component's JSON, so it's always current.
Loading the reference