Accordion

Let users show and hide sections of related content on a page.

Props

heading
string
Sets the heading text.
headingSize
GoabAccordionHeadingSize
Sets the heading size of the accordion container heading.
Defaults to small.
headingType
GoabAccordionHeadingType
Sets the accordion style variant.
Defaults to normal.
iconPosition
GoabAccordionIconPosition
Sets the position of the expand/collapse icon.
Defaults to left.
maxWidth
string
Sets the maximum width of the accordion.
Defaults to none.
open
boolean
Sets the state of the accordion container open or closed.
secondaryText
string
Sets secondary text displayed alongside the heading.
testId
string
Sets a data-testid attribute for automated testing.
mt, mr, mb, ml
Spacing
Apply margin to the top, right, bottom, and/or left of the component.
heading
string
Sets the heading text.
headingSize
GoabAccordionHeadingSize
Sets the heading size of the accordion container heading.
headingType
GoabAccordionHeadingType
Sets the accordion style variant.
iconPosition
GoabAccordionIconPosition
Sets the position of the expand/collapse icon.
maxWidth
string
Sets the maximum width of the accordion.
open
boolean
Sets the state of the accordion container open or closed.
secondaryText
string
Sets secondary text.
testId
string
Sets the data-testid attribute for automated testing.
mt, mr, mb, ml
Spacing
Apply margin to the top, right, bottom, and/or left of the component.
heading
string
Sets the heading text.
heading-type
GoabAccordionHeadingType normal | filled
Sets the accordion style variant. @default "normal"
Defaults to normal.
headingsize
GoabAccordionHeadingSize small | medium
Sets the heading size of the accordion container heading.
Defaults to small.
iconposition
GoabAccordionIconPosition left | right
Sets the position of the expand/collapse icon.
Defaults to left.
id
string
Unique identifier for the accordion.
maxwidth
string
Sets the maximum width of the accordion.
Defaults to none.
open
boolean true | false
Sets the state of the accordion container open or closed.
Defaults to false.
secondarytext
string
Sets secondary text.
testid
string
Sets a data-testid attribute for automated testing.
mt, mr, mb, ml
Spacing
Apply margin to the top, right, bottom, and/or left of the component.

Events

onChange
(open: boolean) => void
Callback fired when the accordion is opened or closed. Receives the new open state as a boolean.
onChange
(event: boolean) => void
Emits when the accordion opens or closes. Emits the new open state as a boolean.
_change
CustomEvent<{ open: boolean }>

ReactNode

actions
ReactNode
Sets content rendered in the accordion heading, right-aligned before the expand/collapse icon.
headingContent
ReactNode
Sets content rendered within the accordion heading, alongside the heading text.
actions
TemplateRef
Sets content rendered in the accordion heading, right-aligned before the expand/collapse icon.
headingContent
TemplateRef
Sets content rendered within the accordion heading, alongside the heading text.
actions
slot
Sets content rendered in the accordion heading, right-aligned before the expand/collapse icon.
headingcontent
slot
Sets content rendered within the accordion heading, alongside the heading text.
Examples

Expand or collapse part of a form

Hide and show many sections of information

Positioning

Enter your full legal name as it appears on your government-issued ID.

Ensure accordion content is left-aligned with the heading, leaving white space on the left side of the container.

Other

Submit
Don't hide key functionality in collapsed accordions. If content is critical to the workflow, it should be visible when the page loads.

Content

Lorem ipsum dolor sit amet consectetur. Felis mauris in interdum congue amet curabitur diam enim. Sem nec ut sed tristique mauris nibh ac.

Don't exceed 75 characters in line length within expanded accordion content.

Content here

Use secondaryText for contextual information in accordions
All GoA Design System components are built to meet WCAG 2.2 AA standards. The following guidelines provide additional context for accessible implementation.

No accessibility-specific guidelines have been documented for this component yet.

View old component docs