Skip to content
Klarhimmel UI

FAQ, centred cards

FAQ, centred cards previewFAQ, centred cards preview

Install

npx shadcn add @klarhimmel/faq-centered
DetailsAbout, usage, props and more

A centred heading over a narrow column of questions, each in its own rounded card that opens on click, and one link at the bottom.

Import

Import

import Block from '@/components/klarhimmel/blocks/faq-centered';
Also called
  • faq/centered
About
A centred heading over a narrow column of questions, each in its own rounded card that opens on click, and one link at the bottom. Gentler than the ruled list and good for short sets of three to six.
Category
The questions people ask before they buy. New project? Set it up once: /get-started/installation.

Notes

When to use it

A short set of three to six questions that a visitor opens on click, each in its own rounded card under a centred heading. If there are many questions or you want every answer visible, faq-rows or faq-columns fits better.

Writing for it

- Both title (120) and each question (160) are required, so write the question the way a customer would type it into a search box, not as a topic label. - Answers stop at 600 characters and sit behind a click, so put the decision-making fact in the first sentence and leave the detail for the rest. - The single link under the cards (more) is meant for a help page; give it a label like the one in the default, 'All questions and answers', that says where it leads.

Watch out for

The 'more' link is drawn only when its label is non-empty, so clearing the label removes the link entirely, whatever the href says. The set must hold at least two items and at most eight.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import FaqCentered from '@/components/klarhimmel/blocks/faq-centered';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <FaqCentered props={{
          "eyebrow": "Section",
          "title": "Say what the answers cover",
          "description": "Say in one sentence what to do if the answer is not here, and who replies.",
          "items": [
            {
              "question": "Ask a question customers have",
              "answer": "Answer in one or two plain sentences, with the key fact first, then what to do or where to go next."
            },
            {
              "question": "Ask a common question",
              "answer": "Answer in one or two plain sentences, with the key fact first, then what to do or where to go next."
            },
            {
              "question": "Ask a common question",
              "answer": "Answer in one or two plain sentences, with the key fact first, then what to do or where to go next."
            },
            {
              "question": "Ask a question customers have first",
              "answer": "Answer in one or two plain sentences, with the key fact first, then what to do or where to go next."
            }
          ],
          "more": {
            "label": "Link to all the answers",
            "href": "#help"
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}

Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

PropTypeDefaultDescription
eyebrowstring'Section'Text, up to 60 characters.
titlestring'Say what the answers cover'Text, up to 120 characters.
descriptionstring'Say in one sentence what to do if t…'Text, up to 300 characters.
items{ question, answer }[]4 itemsList of 2 to 8. Each item: question, answer.
moreLink{…}See the type.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.