Accordion
Collapsibles stacked: one open at a time, or several. Up and Down move between headers.
import { Accordion } from "@forgeron/ui";In the EU, on Cloudflare.
import { Accordion } from "@forgeron/ui";
export default function Faq() {
return (
<div style={{ width: "min(100%, 480px)" }}>
<Accordion
defaultValue={["data"]}
items={[
{
value: "data",
title: "Where is my data stored?",
content: "In the EU, on Cloudflare.",
},
{
value: "export",
title: "Can I export it?",
content: "Yes: CSV and JSON, at any time.",
},
{
value: "soon",
title: "Single sign-on",
hint: "Soon",
content: "Planned.",
disabled: true,
},
]}
/>
</div>
);
}Name, photo, language.
Email and in-app.
import { Accordion } from "@forgeron/ui";
export default function Multiple() {
return (
<div style={{ width: "min(100%, 480px)" }}>
<Accordion
multiple
defaultValue={["a", "b"]}
items={[
{ value: "a", title: "Profile", content: "Name, photo, language." },
{ value: "b", title: "Notifications", content: "Email and in-app." },
{ value: "c", title: "Security", content: "Password and sessions." },
]}
/>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | AccordionItem[] | — | { value, title, hint?, content, disabled? }. |
value / defaultValue | string[] | — | Controlled or not. The values of the open sections. |
onChange | (value: string[]) => void | — | On every change. |
multiple | boolean | false | Several open at once. |
headingLevel | 1–6 | 3 | The level of the headings. |
disabled | boolean | — | Not editable. |
className | string | — | Extra classes. |