Feature - FAQs
A fully editable Frequently Asked Questions with expandable and collapsible sections
What It Does#
Creates an expandable and collapsible FAQ section using Bootstrap accordion
The FAQs feature lets content editors build a list of questions and answers that render as a Bootstrap accordion. Each question appears as a clickable header that expands to reveal the answer, and clicking another question collapses the previous one.
This is a common pattern for support pages, product documentation, and any content where users need to scan through multiple topics without being overwhelmed by all the answers at once.
How It Works#
A Block List of question/answer pairs rendered as a Bootstrap accordion
The feature uses a Block List property (featurePropertyFAQs) containing question/answer element types. Each element has a featurePropertyFAQsQuestion textbox and a featurePropertyFAQsAnswer textarea.
The view iterates through the Block List items and renders each as a Bootstrap accordion item. The accordion uses data-bs-parent to ensure only one answer is visible at a time — opening a new question automatically closes the previous one.
Unique IDs for the accordion and its items are generated from the block's Key property, ensuring multiple FAQ blocks on the same page don't conflict.
Example FAQs#
A selection of questions we are often asked
On this page
featureFAQs.cshtml#
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<BlockGridItem<FeatureFaqs>>
@{
Layout = "_Layout_Features.cshtml";
var content = Model.Content;
var faqItems = content.FeaturePropertyFaqs;
}
@if (faqItems != null && faqItems.Any())
{
foreach (var faq in faqItems.Select(faqItem => faqItem.Content))
{
<div class="accordion accordion-flush"
id="n@(content.Key.ToString("N"))">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed"
data-bs-toggle="collapse"
data-bs-target="#n@(faq.Key.ToString("N"))">
@faq.Value("featurePropertyFAQsQuestion")
</button>
</h2>
<div id="n@(faq.Key.ToString("N"))"
class="accordion-collapse collapse"
data-bs-parent="#n@(content.Key.ToString("N"))">
<div class="accordion-body">
@faq.Value("featurePropertyFAQsAnswer")
</div>
</div>
</div>
</div>
}
}