Layout
Accordion
Stacked headings that each reveal a section — the WAI-ARIA accordion pattern. Collapsed text stays findable with the browser’s find-in-page.
import { Accordion } from '@reactloom/ui';Examples
Single
One panel open at a time; closing the open one is allowed by default.
Invoices are issued monthly in arrears and payable within 30 days.
Yes — SAML 2.0 and OpenID Connect on the Enterprise plan.
In the EU (Frankfurt) by default. US and APAC regions are available.
import { Accordion } from '@reactloom/ui';
const faq = [
['billing', 'How does billing work?', 'Invoices are issued monthly in arrears and payable within 30 days.'],
['sso', 'Do you support single sign-on?', 'Yes — SAML 2.0 and OpenID Connect on the Enterprise plan.'],
['residency', 'Where is my data stored?', 'In the EU (Frankfurt) by default. US and APAC regions are available.'],
];
export default function Example() {
return (
<div style={{ width: '100%', maxWidth: 600 }}>
<Accordion.Root type="single" defaultValue="billing">
{faq.map(([value, question, answer]) => (
<Accordion.Item key={value} value={value}>
<Accordion.Trigger>{question}</Accordion.Trigger>
<Accordion.Content>{answer}</Accordion.Content>
</Accordion.Item>
))}
</Accordion.Root>
</div>
);
}Multiple
Any number open; headingLevel fits the page outline.
Connect a Slack workspace to enable these.
Available on the Enterprise plan.
import { Accordion, Switch, Stack } from '@reactloom/ui';
export default function Example() {
return (
<div style={{ width: '100%', maxWidth: 600 }}>
<Accordion.Root type="multiple" defaultValue={['email']} headingLevel={4}>
<Accordion.Item value="email">
<Accordion.Trigger>Email notifications</Accordion.Trigger>
<Accordion.Content>
<Stack gap="2">
<Switch label="Invoices" defaultChecked />
<Switch label="Product updates" />
</Stack>
</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="slack">
<Accordion.Trigger>Slack notifications</Accordion.Trigger>
<Accordion.Content>Connect a Slack workspace to enable these.</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="sms" disabled>
<Accordion.Trigger>SMS (Enterprise)</Accordion.Trigger>
<Accordion.Content>Available on the Enterprise plan.</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</div>
);
}API reference
Accordion.Root
| Prop | Type | Default |
|---|---|---|
typerequired | 'single' | 'multiple' | — |
value / defaultValue | string | null · string[] | — |
onValueChange | (value) => void | — |
collapsibleSingle mode: allow closing the open panel. | boolean | true |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 |
disabled | boolean | false |
Accordion.Item
| Prop | Type | Default |
|---|---|---|
valuerequired | string | — |
disabled | boolean | false |
Accordion.Trigger · Accordion.Content
| Prop | Type | Default |
|---|---|---|
…Heading button and its labelled region. | ButtonHTMLAttributes · HTMLAttributes | — |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
Theme tokens it reads
--pl-color-border-default
Accessibility
- Each trigger is a button inside a heading; panels are regions labelled by their trigger.
- Collapsed panels use hidden="until-found": find-in-page searches them and opens the match.
- Disabled items expose aria-disabled and stay focusable so they can be discovered.
| Key | Action |
|---|---|
| Enter / Space | Toggle the focused section |
| ↓ / ↑ | Next / previous header |
| Home / End | First / last header |
| Tab | Into the open panel |
Usage guidelines
Do
- Use for FAQs and long settings pages.
- Write headers as questions or clear topics.
Don’t
- Don’t hide content people need to compare side by side.
- Don’t nest accordions.