Overview
The Accordion component is a vertically stacked set of expandable panels. Each Accordion panel consists of a summary and details section. When clicked, the panel expands to reveal the associated content. Accordions are useful for:- Organizing and hiding complex information
- Reducing page clutter and cognitive load
- Creating FAQs and progressive disclosure interfaces
- Grouping related settings or options
Import
Basic Usage
The most basic accordion consists of an Accordion wrapper containing AccordionSummary and AccordionDetails components.Controlled Accordion
Control the expanded state externally using theexpanded and onChange props.
With Actions
Add action buttons to the bottom of an accordion panel using the AccordionActions component.Props
Accordion Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Required. The content of the accordion, typically AccordionSummary and AccordionDetails |
defaultExpanded | boolean | false | If true, expands the accordion by default |
disabled | boolean | false | If true, the accordion is disabled |
disableGutters | boolean | false | If true, removes the margin between two expanded accordion items |
expanded | boolean | - | If true, expands the accordion. Use with onChange for controlled behavior |
onChange | (event: SyntheticEvent, expanded: boolean) => void | - | Callback fired when the expand/collapse state changes |
square | boolean | false | If true, rounded corners are disabled (inherited from Paper) |
elevation | number | 1 | Shadow depth, accepts values between 0 and 24 (inherited from Paper) |
sx | SxProps<Theme> | - | System prop for defining CSS styles |
slotProps | object | - | Props applied to internal slots (root, heading, transition, region) |
slots | object | - | Custom components for internal slots |
AccordionSummary Props
The clickable header that expands/collapses the accordion.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The content of the accordion summary |
expandIcon | ReactNode | - | The icon to display for the expand indicator |
aria-controls | string | - | The id of the corresponding AccordionDetails |
id | string | - | Unique identifier for the summary |
AccordionDetails Props
The collapsible content area of the accordion.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The content of the accordion details |
sx | SxProps<Theme> | - | System prop for defining CSS styles |
AccordionActions Props
Optional action buttons displayed at the bottom of the details section.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The action buttons |
disableSpacing | boolean | false | If true, removes the default spacing |
Slots
The Accordion component supports customization through slots:- root: The root Paper component (default:
Paper) - heading: The heading element wrapper (default:
'h3') - transition: The transition component (default:
Collapse) - region: The content region wrapper (default:
'div')
Accessibility
The Accordion component follows WAI-ARIA authoring practices:- The accordion header has
role="button" - Use
aria-controlsto link the summary to its details section - Use
aria-expandedto indicate the current state (automatically managed) - Use semantic heading levels through the
headingslot - Ensure keyboard navigation is supported (automatically handled)
Best Practices
- Don’t nest accordions - Avoid placing accordions inside other accordions as this creates confusing navigation
- Use clear labels - Make summary text descriptive so users know what content will be revealed
- Consider default state - Use
defaultExpandedfor critical information that should be visible initially - Limit the number - Too many accordions can be overwhelming; consider alternative layouts for large amounts of content
- Mobile friendly - Accordions work well on mobile devices where screen space is limited
API Reference
- Accordion API - Full API documentation
- Inherits Paper API
- Source:
packages/mui-material/src/Accordion/Accordion.d.ts:1