FAQ disclosure
Questions in native <details> elements with a plus that turns into a cross when open.
id faq-disclosure · revision 00e6e8d41633 · catalogue 0.1.0
Preview
Every token this component reads is set by the style, and every font is loaded or a system font.
Hover and keyboard focus
The component's own hover and focus styles, switched on for every link and button at once so you can see them without a mouse. In the previews above they work as usual.
Copy it
These two files are exactly what the previews above render. The MCP tool get_component returns the same files.
- Save FaqDisclosure.tsx with your components and styles/neat-paper.css with your styles.
- Import styles/neat-paper.css once, after @import "tailwindcss" in your global stylesheet.
- Make sure Tailwind scans the folder that holds the component.
- For dark mode, set data-theme="dark" on the <html> element.
- Add <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,[email protected],600&display=swap"> to the document head.
components/FaqDisclosure.tsx
export interface Question {
question: string;
answer: string;
}
export interface FaqDisclosureProps {
heading?: string;
questions?: Question[];
/** Index of the question that starts open. Omit to start with all closed. */
openIndex?: number;
}
const focusRing =
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--nl-focus)]";
/**
* Questions as native disclosure widgets. Keyboard and screen reader support
* come from <details> and <summary>, and it needs no client JavaScript.
*/
export function FaqDisclosure({
heading = "Questions",
questions = [
{ question: "Does anything publish without approval?", answer: "No. Every draft waits for someone on your team to approve it." },
{ question: "Which repositories can I connect?", answer: "Any GitHub repository you can install an app on, public or private." },
{ question: "Can I export my notes?", answer: "Yes. Download every note as Markdown from the settings page." },
{ question: "What happens when my trial ends?", answer: "Your drafts stay. Publishing pauses until you choose a plan." },
],
openIndex,
}: FaqDisclosureProps) {
return (
<section className="bg-[color:var(--nl-canvas)] px-6 py-[var(--nl-section-y)] font-[family-name:var(--nl-font-sans)] text-[color:var(--nl-ink)]">
<div className="mx-auto max-w-3xl">
<h2 className="font-[family-name:var(--nl-font-display)] text-3xl font-semibold sm:text-4xl">{heading}</h2>
<div className="mt-10 divide-y divide-[color:var(--nl-line)] border-y border-[color:var(--nl-line)]">
{questions.map((item, index) => (
<details key={item.question} open={index === openIndex} className="group">
<summary
className={`flex cursor-pointer list-none items-center justify-between gap-6 rounded-[var(--nl-radius)] py-5 font-medium [&::-webkit-details-marker]:hidden ${focusRing}`}
>
{item.question}
<span aria-hidden="true" className="font-[family-name:var(--nl-font-mono)] text-[color:var(--nl-muted)] group-open:rotate-45 motion-safe:transition-transform">
+
</span>
</summary>
<p className="pb-6 leading-relaxed text-[color:var(--nl-muted)]">{item.answer}</p>
</details>
))}
</div>
</div>
</section>
);
}
styles/neat-paper.css
/* Neat Labs theme "paper" (revision 9e029aa69c45) for faq-disclosure (revision 00e6e8d41633), catalogue 0.1.0. */
:root {
--nl-canvas: #F5F1E8;
--nl-ink: #1F1B16;
--nl-muted: #5E554A;
--nl-line: #D9D0C1;
--nl-focus: #1F5FBF;
--nl-font-display: "Fraunces", ui-serif, Georgia, serif;
--nl-font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--nl-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
--nl-radius: 6px;
--nl-section-y: 96px;
}
[data-theme="dark"] {
--nl-canvas: #16130F;
--nl-ink: #F2ECE1;
--nl-muted: #B3A999;
--nl-line: #3A342C;
--nl-focus: #8AB4F8;
}
MCP tool call
{
"name": "get_component",
"arguments": {
"id": "faq-disclosure",
"style": "paper"
}
}