Components/Layout

Accordion

Accordions are stacked rows that each hide a panel of content until the reader opens it. They let a long page offer many sections at once while showing only the one that was asked for. A row’s label is what tells the reader whether it holds the answer they came for, so it carries most of the weight.

import { Accordion } from '@growth-protocol-ai/alpha';

On this page

Monthly, on the day you subscribed, to the card on file.

Yes. Your plan stays active until the end of the period you paid for.

Within fourteen days of a charge, for any reason.

size
state
Accordion.tsxtsx
1import { Accordion } from '@growth-protocol-ai/alpha';
2
3<Accordion size="regular" multiple={false} defaultOpen={['billing']}>
4 <AccordionItem value="billing" label="How is my plan billed?">
5 <p>Monthly, on the day you subscribed, to the card on file.</p>
6 </AccordionItem>
7 <AccordionItem value="cancel" label="Can I cancel at any time?">
8 <p>
9 Yes. Your plan stays active until the end of the period you paid for.
10 </p>
11 </AccordionItem>
12 <AccordionItem value="refund" label="Do you offer refunds?">
13 <p>Within fourteen days of a charge, for any reason.</p>
14 </AccordionItem>
15</Accordion>

When to use

Reach for an accordion when a surface holds several independent sections and any given reader wants one or two of them. It trades a screen of scrolling for a click per answer, which is a good trade for a list of questions and a poor one for anything the reader has to read in order.

When not to use

Do not hide behind an accordion anything the reader needs in order to get on — a form put in one costs them a click per field. Sections that are alternatives rather than a stack belong in tabs, and a lone section that opens is usually a section that should simply be on the page.

size2 values

How much room a trigger row takes, set on the group so every row in it matches. Both draw the same separator and the same glyph at the same size — only the padding and the label’s type change, and the row’s height is what those two add up to rather than a number of its own.

Monthly, on the day you subscribed, to the card on file.

Yes, and your plan runs to the end of the period you paid for.

regular

Monthly, on the day you subscribed, to the card on file.

Yes, and your plan runs to the end of the period you paid for.

large
sizeWhen to use
regularThe default. Tight padding and the button’s type size, for an accordion inside something else — a settings panel, a sidebar, a card.
largeGenerous padding and heading type, for an accordion that is the page rather than a part of it. An FAQ, a long-form disclosure list.