Faq One
The FAQ One block is a composable section that renders a heading, rich text body, and a list of expandable question/answer items. It is built on top of the Accordion and RichText components.
Frequently Asked Questions
Find answers to common questions about getting started, customization, and best practices.
import mockedFaqBlock from "@/data/mock/optimizely/faq/faq-block.json";import { faqCmsMappers } from "@/registry/rokkit200-ui/blocks/faq/internals/lib/faq-utils";import { FaqOne } from "@/registry/rokkit200-ui/blocks/faq/variants/faq-one/faq-one";import { mapCmsType } from "@/registry/rokkit200-ui/lib/content-mapper/content-mapper-util";import { faqBlockCodeModel, faqBlockFragment, faqItemBlockCodeModel,} from "../constants";
export default function FaqOneDefaultDemo() { const properties = mapCmsType( faqCmsMappers, mockedFaqBlock.data.FaqBlock.item );
return <FaqOne {...properties!} />;}SaaS
In a SaaS CMS, the content model is fully managed by the platform — no code required. Download this pre-built model definition and import it directly into your CMS to get started immediately.
Download SaaS ModelPaaS
In a PaaS CMS, content models are defined in code and deployed alongside your application. Use the C# model below as a starting point and adapt it to fit your project's conventions.
[SiteContentType( GUID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", /// TODO: Replace GUID GroupName = Globals.GroupNames.Content, DisplayName = "FAQ Item Block", Description = "A block for individual frequently asked questions and answers entries.")]public class FaqItemBlock : SiteBlockData{ [CultureSpecific] [Required(AllowEmptyStrings = false)] [Display( GroupName = SystemTabNames.Content, Order = 10, Name = "Heading")] public virtual string Heading { get; set; }
[CultureSpecific] [Required(AllowEmptyStrings = false)] [Display( GroupName = SystemTabNames.Content, Order = 20, Name = "Main Body")] public virtual XhtmlString MainBody { get; set; }}[SiteContentType( GUID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", /// TODO: Replace GUID GroupName = Globals.GroupNames.Content, DisplayName = "FAQ Block", Description = "A block to display frequently asked questions and answers.")]public class FaqBlock : SiteBlockData{ [CultureSpecific] [Display( GroupName = SystemTabNames.Content, Order = 10, Name = "Heading")] public virtual string Heading { get; set; }
[CultureSpecific] [Display( GroupName = SystemTabNames.Content, Order = 20, Name = "Main Body")] public virtual XhtmlString MainBody { get; set; }
[CultureSpecific] [Display( GroupName = SystemTabNames.Content, Order = 30, Name = "Items")] [AllowedTypes(typeof(FaqItemBlock))] public virtual ContentArea Items { get; set; }}query FaqBlockQuery { FaqBlock { item { ...FaqBlockFragment } } }
fragment FaqBlockFragment on FaqBlock { Heading MainBody { json } Items { Heading MainBody { json } } }Composition
Section titled “Composition”The FAQ One block composes the following components:
| Component | Role |
|---|---|
| RichText | Renders the block body and each FAQ item answer |
| Accordion | Renders the expandable question/answer list |
Below is an example of how to use the FaqOne in your site.
import { FaqOne } from "@/rokkit200-ui/blocks/faq/variants/faq-one/faq-one";import { mapCmsType } from "@/rokkit200-ui/lib/content-mapper/content-mapper-util";import { faqCmsMappers } from "@/rokkit200-ui/blocks/faq/faq-one/internals/lib/faq-utils";const properties = mapCmsType(faqCmsMappers, faqResponse);
return <FaqOne {...properties!} />;Customisation
Section titled “Customisation”Compact layout
Section titled “Compact layout”Use className overrides to constrain width and reduce text size for a compact FAQ presentation.
Frequently Asked Questions
Find answers to common questions about getting started, customization, and best practices.
import mockedFaqBlock from "@/data/mock/optimizely/faq/faq-block.json";import { faqCmsMappers } from "@/registry/rokkit200-ui/blocks/faq/internals/lib/faq-utils";import { FaqOne } from "@/registry/rokkit200-ui/blocks/faq/variants/faq-one/faq-one";import { mapCmsType } from "@/registry/rokkit200-ui/lib/content-mapper/content-mapper-util";
export default function FaqOneCompactDemo() { const properties = mapCmsType( faqCmsMappers, mockedFaqBlock.data.FaqBlock.item );
return ( <FaqOne {...properties!} className="mx-auto max-w-2xl" headingClassName="text-2xl" bodyClassName="text-sm" accordionClassName="text-sm" /> );}Custom styling
Section titled “Custom styling”Use the className, headingClassName, bodyClassName, and accordionClassName props to customise the appearance.
Frequently Asked Questions
Find answers to common questions about getting started, customization, and best practices.
import mockedFaqBlock from "@/data/mock/optimizely/faq/faq-block.json";import { faqCmsMappers } from "@/registry/rokkit200-ui/blocks/faq/internals/lib/faq-utils";import { FaqOne } from "@/registry/rokkit200-ui/blocks/faq/variants/faq-one/faq-one";import { mapCmsType } from "@/registry/rokkit200-ui/lib/content-mapper/content-mapper-util";
export default function FaqOneCustomStyledDemo() { const properties = mapCmsType( faqCmsMappers, mockedFaqBlock.data.FaqBlock.item );
return ( <FaqOne {...properties!} className="rounded-xl border border-zinc-300 p-6 dark:border-zinc-600" headingClassName="text-3xl text-blue-600 dark:text-blue-400" bodyClassName="italic text-zinc-500 dark:text-zinc-400" accordionClassName="rounded-lg" /> );}API Reference
Section titled “API Reference”| Prop | Type | Default | Description |
|---|---|---|---|
heading | string | — | The FAQ section heading |
mainBody | RichTextNode[] | undefined | — | Rich text content rendered below the heading |
items | FaqItemProperties[] | — | Array of FAQ items with id, heading, and mainBody |
className | string | — | Class name for the root <section> element |
headingClassName | string | — | Class name for the <h2> heading |
bodyClassName | string | — | Class name for the body <RichText> |
accordionClassName | string | — | Class name for the <Accordion> wrapper |
Accessibility
Section titled “Accessibility”- The root element is a
<section>witharia-labelledbyreferencing the heading. - Each FAQ item is rendered as an accordion panel with proper ARIA attributes, keyboard navigation, and focus management provided by Base UI.
- The heading is rendered as an
<h2>element.
Related patterns
Section titled “Related patterns”- Grouped Content — for organising related content sections