component FAQAccordion { props { eyebrow = "" title = "Frequently asked questions" description = "" items = [] centered = true compact = false allowMultiple = false defaultOpenIndex = 0 showContact = false contactText = "Still have questions?" contactLabel = "Contact support" contactHref = "/support" } state openIndexes = defaultOpenIndex >= 0 ? [defaultOpenIndex] : [] functions { function isOpen(index) { return openIndexes.includes(index) } function toggleItem(index) { if (isOpen(index)) { openIndexes = openIndexes.filter( (itemIndex) => itemIndex !== index ) } else if (allowMultiple) { openIndexes = [...openIndexes, index] } else { openIndexes = [index] } } } view {

{eyebrow}

{title}

{description}

{contactText}

{#if contactLabel !== '' && contactHref !== ''} {contactLabel} {/if}
{#each items as item, index}

{item.answer}

{#if item.linkLabel !== '' && item.href !== ''} {item.linkLabel} {/if}
{/each}
} }