FAQ blocks
Accordion and open question sections with readable answers and generous targets.
Write the question the way a person would ask it, then answer in the first sentence.
Centered questions
A narrow list under a short heading. The whole row opens the answer.
import * as React from "react"
import { EXAMPLE_QUESTIONS } from "@/components/marketing/foundation/example-questions"
import { QuestionList } from "@/components/marketing/foundation/question-list"
import {
MarketingContainer,
MarketingSection,
} from "@/components/marketing/foundation/section"
import { SectionHeading } from "@/components/marketing/foundation/section-heading"
import type { MarketingQuestion } from "@/components/marketing/foundation/types"
interface FaqCenteredProps {
title?: React.ReactNode
description?: React.ReactNode
/** Five to eight. */
questions?: MarketingQuestion[]
/** The question to open at first. */
defaultOpen?: number
/** An anchor for links within the page. */
id?: string
className?: string
}
/** A narrow list of questions under a short heading. */
export function FaqCentered({
title = "Before you ask your team to switch",
description = "Short answers to what people ask us in the first call.",
questions = EXAMPLE_QUESTIONS,
defaultOpen,
id,
className,
}: FaqCenteredProps) {
const titleId = React.useId()
return (
<MarketingSection aria-labelledby={titleId} id={id} className={className}>
<MarketingContainer size="prose">
<SectionHeading align="center" titleId={titleId} title={title} description={description} />
<QuestionList
questions={questions}
defaultOpen={defaultOpen}
className="mt-(--mkt-head-gap)"
/>
</MarketingContainer>
</MarketingSection>
)
}
export type { FaqCenteredProps }
Split questions with contact
The heading stays beside the questions as they scroll, with people to ask underneath. On a phone the contact moves below the list.
import * as React from "react"
import { TextLink } from "@/components/marketing/foundation/action-group"
import { EXAMPLE_QUESTIONS } from "@/components/marketing/foundation/example-questions"
import { Portrait } from "@/components/marketing/foundation/person"
import { QuestionList } from "@/components/marketing/foundation/question-list"
import {
MarketingContainer,
MarketingSection,
} from "@/components/marketing/foundation/section"
import { SectionHeading } from "@/components/marketing/foundation/section-heading"
import type {
MarketingLink,
MarketingPerson,
MarketingQuestion,
} from "@/components/marketing/foundation/types"
interface FaqSplitProps {
title?: React.ReactNode
description?: React.ReactNode
questions?: MarketingQuestion[]
defaultOpen?: number
/** Who answers when the list does not. */
contact?: {
people: MarketingPerson[]
title: string
description: string
link: MarketingLink
}
/** An anchor for links within the page. */
id?: string
className?: string
}
const DEFAULT_CONTACT: NonNullable<FaqSplitProps["contact"]> = {
people: [{ name: "Lena Hoff" }, { name: "Marcus Bell" }, { name: "Yuki Arai" }],
title: "Something else?",
description: "Lena, Marcus and Yuki answer within one working day.",
link: { label: "Ask us", href: "#contact" },
}
/** The heading stays beside the questions, with a person to ask at its foot. */
export function FaqSplit({
title = "Questions, answered plainly.",
description = "The ones we hear most, about reviewers, versions, data and billing.",
questions = EXAMPLE_QUESTIONS,
defaultOpen = 0,
contact = DEFAULT_CONTACT,
id,
className,
}: FaqSplitProps) {
const titleId = React.useId()
return (
<MarketingSection aria-labelledby={titleId} id={id} className={className}>
<MarketingContainer>
<div className="grid gap-x-(--mkt-column-gap) gap-y-10 lg:grid-cols-12">
<div className="lg:sticky lg:top-24 lg:col-span-5 lg:self-start lg:pe-10">
<SectionHeading titleId={titleId} title={title} description={description} />
{contact && (
<div className="mt-9 hidden lg:block">
<FaqContact contact={contact} />
</div>
)}
</div>
<div className="lg:col-span-7">
<QuestionList questions={questions} defaultOpen={defaultOpen} />
{contact && (
<div className="mt-9 lg:hidden">
<FaqContact contact={contact} />
</div>
)}
</div>
</div>
</MarketingContainer>
</MarketingSection>
)
}
function FaqContact({ contact }: { contact: NonNullable<FaqSplitProps["contact"]> }) {
return (
<div className="flex flex-col items-start gap-4 rounded-(--mkt-radius-panel) bg-(--mkt-wash) p-6">
<span className="flex -space-x-2">
{contact.people.map((person) => (
<Portrait
key={person.name}
person={person}
size="sm"
className="bg-(--mkt-frame) shadow-[0_0_0_2px_var(--mkt-wash),inset_0_0_0_0.5px_var(--mkt-line-strong)]"
/>
))}
</span>
<div>
<p className="m-0 text-[1.0625rem] leading-6.5 tracking-[-0.014em] [font-weight:500]">
{contact.title}
</p>
<p className="mkt-body [font-size:0.9375rem]">{contact.description}</p>
</div>
<TextLink link={contact.link} />
</div>
)
}
export type { FaqSplitProps }
Open question grid
Every answer in view. For a few questions that all deserve reading.
import * as React from "react"
import { EXAMPLE_QUESTIONS } from "@/components/marketing/foundation/example-questions"
import {
MarketingContainer,
MarketingSection,
} from "@/components/marketing/foundation/section"
import { SectionHeading } from "@/components/marketing/foundation/section-heading"
import type { MarketingQuestion } from "@/components/marketing/foundation/types"
interface FaqOpenGridProps {
title?: React.ReactNode
description?: React.ReactNode
/** Four to six short ones. */
questions?: MarketingQuestion[]
/** An anchor for links within the page. */
id?: string
className?: string
}
/** Every answer in view. For a few questions that all deserve reading. */
export function FaqOpenGrid({
title = "What people check first.",
description,
questions = EXAMPLE_QUESTIONS.filter((_, index) => index !== 2).slice(0, 4),
id,
className,
}: FaqOpenGridProps) {
const titleId = React.useId()
return (
<MarketingSection aria-labelledby={titleId} id={id} className={className}>
<MarketingContainer>
<SectionHeading titleId={titleId} title={title} description={description} />
<dl className="m-0 mt-(--mkt-head-gap) grid gap-x-[clamp(2rem,1rem+5vw,6rem)] gap-y-10 md:grid-cols-2 md:gap-y-14">
{questions.map((item) => (
<div key={item.question} className="border-t-[0.5px] border-(--mkt-line-strong) pt-6">
<dt className="mkt-title text-(--mkt-ink)">{item.question}</dt>
<dd className="mkt-body m-0 mt-2.5 max-w-[34rem] [&_a]:underline [&_a]:underline-offset-4 [&_p+p]:mt-3 [&_p]:m-0">
{item.answer}
</dd>
</div>
))}
</dl>
</MarketingContainer>
</MarketingSection>
)
}
export type { FaqOpenGridProps }
Usage
Every prop has a default, so a block renders as soon as it is installed. Pass your own content to replace it.
import { FaqSplit } from "@/components/marketing/faq-split"
<FaqSplit
questions={[
{ question: "Do reviewers need an account?", answer: <p>No. They approve from a link.</p> },
]}
/>