Skip to content
New

FAQ, accordion

beta

A title beside three to twelve questions that open one by one, and a contact link; closed answers stay findable.

npx rasengan-ui add faq-accordion

Questions, answered

What studios ask us before they switch.

Still have a question?Write to us

Use it
Answering objections near the pricing or the end of a page.
Avoid it
Long documentation answers: link to the docs instead.
Built with
AccordionButton

Installation

Terminal
npx rasengan-ui add faq-accordion

It installs into components/blocks/faq-accordion/, with what it uses (Accordion, Button) and lib/blocks.ts.

Usage

Without content, the block shows its example. Pass your own, typed by the block's schema, from a content file (here, the example with one field changed):

app/_routes/index.page.tsx
import { FaqAccordion } from "@/components/blocks/faq-accordion";
import { home } from "@/content/home";
 
export default function Home() {
  return <FaqAccordion content={home.faq} />;
}
content/home.ts
import { example, type FaqAccordionContent } from "@/components/blocks/faq-accordion";
 
export const home = {
  faq: {
    ...example,
    title: "Your section title",
  } satisfies FaqAccordionContent,
};

Closed answers are rendered with hidden="until-found": search engines read them, and the browser's find-in-page opens the one that matches.

Content

FieldTypeLimitsGuidance
titlestring6–70 charsUsually 'Questions, answered' or 'Frequently asked questions'.
sublineoptionalstring≤ 180 chars
itemsobject[]3–12 itemsThe questions people actually ask before buying, in their words.
items[].questionstring6–120 chars
items[].answerstring6–400 chars
contactoptionalobjectA way out for a question not on the list.
contact.textstring6–80 chars'Still have a question?'
contact.ctaobject
contact.cta.labelstring1–32 charsA verb first, two to four words: 'Start free', 'Book a table'.
contact.cta.hrefstringA path ('/pricing'), an anchor ('#menu'), or a full URL.

Props

PropNotes
contentFaqAccordionContent; the example when left out
idthe section's id, for anchor links; "faq" by default
headingLevel1, 2 or 3: the heading's tag; 2 by default
classNameon the root element, for spacing

Accessibility

  • Each question is a button that opens its answer, with Base UI's keyboard support and ARIA.
  • The title and the contact link come before the questions in reading order.