Accordion
Reveal related detail sections without leaving the page.
This guide covers Material UI Core with the default Emotion engine; extensions and additional demos are explicitly classified.
Use case and business boundary
Expansion is local UI state, not data loading; keep headings and aria relationships intact.
Native composition and scope
Accordion, AccordionActions, AccordionDetails, AccordionSummary
Preserve native Material UI composition and types; do not substitute JGuang UI/Base UI/Radix APIs. Example entries are not extra components.
Native installation and initialization
npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1
Use native npm and Emotion, not an invented JGuang UI Registry URL. Place examples inside native ThemeProvider; choose CssBaseline or ScopedCssBaseline for the project. Inspect React, existing providers, lockfile and SSR first. Never overwrite files or conceal peer conflicts. This batch verified React 19.2.8; React 18 and below require matching react-is. See the included bilingual setup guide.
Practical native parameters
These selected parameters are not a flattened universal API. Preserve the native declaring owner, slot structure, nullable values and generics.
| Owner.prop | Practical role | Declaration source |
|---|---|---|
Accordion.expanded | Controlled Accordion expansion; update it in onChange. | Accordion |
Accordion.onChange | Owning control's native callback; preserve its exact event/value/nullable signature. | Accordion |
Accordion.defaultExpanded | Initial uncontrolled Accordion expansion, not a continuing controlled value. | Accordion |
Accordion.disabled | Native disabled interaction state; not an authorization check. | Accordion |
Runnable native examples
Machine keys select example entries, not universal variant props. Native demo JSX/data stay unchanged; JGuang-authored acceptance fixtures are explicitly labelled.
- Introduction ·
AccordionUsage· upstream native demo - Expand icon ·
AccordionExpandIcon· upstream native demo - Expanded by default ·
AccordionExpandDefault· upstream native demo - Transition ·
AccordionTransition· upstream native demo - Disabled item ·
DisabledAccordion· upstream native demo - Controlled Accordion ·
ControlledAccordions· upstream native demo - Only one expanded at a time ·
CustomizedAccordions· upstream native demo
Actual usage example
Unmodified pinned native demo; copy its required local helper files together.
import * as React from 'react';
import Accordion from '@mui/material/Accordion';
import AccordionActions from '@mui/material/AccordionActions';
import AccordionSummary from '@mui/material/AccordionSummary';
import AccordionDetails from '@mui/material/AccordionDetails';
import Typography from '@mui/material/Typography';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import Button from '@mui/material/Button';
export default function AccordionUsage() {
const id = React.useId();
return (
<div>
<Accordion>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls={`${id}-panel1-content`}
id={`${id}-panel1-header`}
>
<Typography component="span">Accordion 1</Typography>
</AccordionSummary>
<AccordionDetails>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget.
</AccordionDetails>
</Accordion>
<Accordion>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls={`${id}-panel2-content`}
id={`${id}-panel2-header`}
>
<Typography component="span">Accordion 2</Typography>
</AccordionSummary>
<AccordionDetails>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget.
</AccordionDetails>
</Accordion>
<Accordion defaultExpanded>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls={`${id}-panel3-content`}
id={`${id}-panel3-header`}
>
<Typography component="span">Accordion Actions</Typography>
</AccordionSummary>
<AccordionDetails>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget.
</AccordionDetails>
<AccordionActions>
<Button>Cancel</Button>
<Button>Agree</Button>
</AccordionActions>
</Accordion>
</div>
);
}
Example dependency boundaries
react, @mui/material/Accordion, @mui/material/AccordionActions, @mui/material/AccordionSummary, @mui/material/AccordionDetails, @mui/material/Typography, @mui/icons-material/ExpandMore, @mui/material/Button, @mui/icons-material/ArrowDownward, @mui/icons-material/ArrowDropDown, @mui/material/Fade, @mui/material/styles, @mui/icons-material/ArrowForwardIosSharp
Direct Icons/System/Utils example imports require their matching 9.4.0 packages. Relative data/helpers are part of the example closure, not extra components. Remote images and simulated operations do not supply a backend.
Pinned upstream API metadata reference
These tables retain the upstream metadata, not a newly inferred generic type system. Conditional generics, inherited props and callback details are defined by the source declarations below. Theme defaults may override metadata defaults.
Accordion
import Accordion from '@mui/material/Accordion';
import { Accordion } from '@mui/material';
Native inheritance: Paper. Parent/DOM props are not fabricated as additional own props.
| Prop | Required | Upstream metadata type / constraint | Metadata default |
|---|---|---|---|
children | yes | node | — |
classes | no | object | — |
defaultExpanded | no | bool | false |
disabled | no | bool | false |
disableGutters | no | bool | false |
expanded | no | bool | — |
onChange | no | func | — |
slotProps | no | { heading?: func | object, region?: func | object, root?: func | object, transition?: func | object } | {} |
slots | no | { heading?: elementType, region?: elementType, root?: elementType, transition?: elementType } | {} |
sx | no | Array<func | object | bool> | func | object | — |
AccordionActions
import AccordionActions from '@mui/material/AccordionActions';
import { AccordionActions } from '@mui/material';
| Prop | Required | Upstream metadata type / constraint | Metadata default |
|---|---|---|---|
children | no | node | — |
classes | no | object | — |
disableSpacing | no | bool | false |
sx | no | Array<func | object | bool> | func | object | — |
AccordionDetails
import AccordionDetails from '@mui/material/AccordionDetails';
import { AccordionDetails } from '@mui/material';
| Prop | Required | Upstream metadata type / constraint | Metadata default |
|---|---|---|---|
children | no | node | — |
classes | no | object | — |
sx | no | Array<func | object | bool> | func | object | — |
AccordionSummary
import AccordionSummary from '@mui/material/AccordionSummary';
import { AccordionSummary } from '@mui/material';
Native inheritance: ButtonBase. Parent/DOM props are not fabricated as additional own props.
| Prop | Required | Upstream metadata type / constraint | Metadata default |
|---|---|---|---|
children | no | node | — |
classes | no | object | — |
expandIcon | no | node | — |
focusVisibleClassName | no | string | — |
slotProps | no | { content?: func | object, expandIconWrapper?: func | object, root?: func | object } | {} |
slots | no | { content?: elementType, expandIconWrapper?: elementType, root?: elementType } | {} |
sx | no | Array<func | object | bool> | func | object | — |
Native source declarations
Declarations/imports are extracted from pinned source without flattening unions or external inheritance. Original English comments/types are source reference, not a claim of translated upstream prose. Shared types stay in their native packages.
vendor/src/Accordion/Accordion.d.ts
import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from '../styles';
import { TransitionProps } from '../transitions/types';
import { AccordionClasses } from './accordionClasses';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
import { ExtendPaperTypeMap, PaperProps } from '../Paper/Paper';
import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from '../utils/types';
export interface AccordionSlots {
/**
* The component that renders the root.
* @default Paper
*/
root: React.ElementType;
/**
* The component that renders the heading.
* @default 'h3'
*/
heading: React.ElementType;
/**
* The component that renders the transition.
* [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
* @default Collapse
*/
transition: React.ElementType;
/**
* The component that renders the region.
* @default 'div'
*/
region: React.ElementType;
}
export interface AccordionRootSlotPropsOverrides {}
export interface AccordionHeadingSlotPropsOverrides {}
export interface AccordionTransitionSlotPropsOverrides {}
export interface AccordionRegionSlotPropsOverrides {}
export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<
AccordionSlots,
{
/**
* Props forwarded to the root slot.
* By default, the available props are based on the Paper element.
*/
root: SlotProps<
React.ElementType<PaperProps>,
AccordionRootSlotPropsOverrides,
AccordionOwnerState
>;
/**
* Props forwarded to the heading slot.
* By default, the available props are based on the h3 element.
*/
heading: SlotProps<'h3', AccordionHeadingSlotPropsOverrides, AccordionOwnerState>;
/**
* Props forwarded to the transition slot.
* By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component.
*/
transition: SlotComponentProps<
React.ElementType<TransitionProps>,
TransitionProps & AccordionTransitionSlotPropsOverrides,
AccordionOwnerState
>;
/**
* Props forwarded to the region slot.
* By default, the available props are based on the div element.
*/
region: SlotProps<'div', AccordionRegionSlotPropsOverrides, AccordionOwnerState>;
}
>;
export interface AccordionOwnProps {
/**
* The content of the component.
*/
children: NonNullable<React.ReactNode>;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<AccordionClasses> | undefined;
/**
* If `true`, expands the accordion by default.
* @default false
*/
defaultExpanded?: boolean | undefined;
/**
* If `true`, the component is disabled.
* @default false
*/
disabled?: boolean | undefined;
/**
* If `true`, it removes the margin between two expanded accordion items and prevents the increased height when expanded.
* @default false
*/
disableGutters?: boolean | undefined;
/**
* If `true`, expands the accordion, otherwise collapses it.
* Setting this prop enables control over the accordion.
*/
expanded?: boolean | undefined;
/**
* Callback fired when the expand/collapse state is changed.
*
* @param {React.SyntheticEvent} event The event source of the callback. **Warning**: This is a generic event not a change event.
* @param {boolean} expanded The `expanded` state of the accordion.
*/
onChange?: ((event: React.SyntheticEvent, expanded: boolean) => void) | undefined;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
}
export type AccordionTypeMap<
AdditionalProps = {},
RootComponent extends React.ElementType = 'div',
> = ExtendPaperTypeMap<
{
props: AdditionalProps & AccordionOwnProps & AccordionSlotsAndSlotProps;
defaultComponent: RootComponent;
},
'onChange' | 'classes'
>;
declare const Accordion: OverridableComponent<AccordionTypeMap>;
export type AccordionProps<
RootComponent extends React.ElementType = AccordionTypeMap['defaultComponent'],
AdditionalProps = {},
> = OverrideProps<AccordionTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
component?: React.ElementType | undefined;
};
export interface AccordionOwnerState extends AccordionProps {}
vendor/src/AccordionActions/AccordionActions.d.ts
import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from '../styles';
import { InternalStandardProps as StandardProps } from '../internal';
import { AccordionActionsClasses } from './accordionActionsClasses';
export interface AccordionActionsProps extends StandardProps<React.HTMLAttributes<HTMLDivElement>> {
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<AccordionActionsClasses> | undefined;
/**
* If `true`, the actions do not have additional margin.
* @default false
*/
disableSpacing?: boolean | undefined;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
}
export default function AccordionActions(props: AccordionActionsProps): React.JSX.Element;
vendor/src/AccordionDetails/AccordionDetails.d.ts
import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from '../styles';
import { InternalStandardProps as StandardProps } from '../internal';
import { AccordionDetailsClasses } from './accordionDetailsClasses';
export interface AccordionDetailsProps extends StandardProps<React.HTMLAttributes<HTMLDivElement>> {
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<AccordionDetailsClasses> | undefined;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
}
export default function AccordionDetails(props: AccordionDetailsProps): React.JSX.Element;
vendor/src/AccordionSummary/AccordionSummary.d.ts
import * as React from 'react';
import { SxProps } from '@mui/system';
import { ButtonBaseProps, ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
import { OverrideProps } from '../OverridableComponent';
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
import { Theme } from '../styles';
import { AccordionSummaryClasses } from './accordionSummaryClasses';
export interface AccordionSummarySlots {
/**
* The component that renders the root slot.
* @default ButtonBase
*/
root: React.ElementType;
/**
* The component that renders the content slot.
* @default div
*/
content: React.ElementType;
/**
* The component that renders the expand icon wrapper slot.
* @default div
*/
expandIconWrapper: React.ElementType;
}
export interface AccordionSummaryRootSlotPropsOverrides {}
export interface AccordionSummaryContentSlotPropsOverrides {}
export interface AccordionSummaryExpandIconWrapperSlotPropsOverrides {}
export type AccordionSummarySlotsAndSlotProps = CreateSlotsAndSlotProps<
AccordionSummarySlots,
{
/**
* Props forwarded to the root slot.
* By default, the available props are based on the [ButtonBase](https://mui.com/material-ui/api/button-base/#props) component.
*/
root: SlotProps<
React.ElementType<ButtonBaseProps>,
AccordionSummaryRootSlotPropsOverrides,
AccordionSummaryOwnerState
>;
/**
* Props forwarded to the content slot.
* By default, the available props are based on a div element.
*/
content: SlotProps<
'div',
AccordionSummaryContentSlotPropsOverrides,
AccordionSummaryOwnerState
>;
/**
* Props forwarded to the expand icon wrapper slot.
* By default, the available props are based on a div element.
*/
expandIconWrapper: SlotProps<
'div',
AccordionSummaryExpandIconWrapperSlotPropsOverrides,
AccordionSummaryOwnerState
>;
}
>;
export interface AccordionSummaryOwnProps extends AccordionSummarySlotsAndSlotProps {
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<AccordionSummaryClasses> | undefined;
/**
* The icon to display as the expand indicator.
*/
expandIcon?: React.ReactNode;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
}
export type AccordionSummaryTypeMap<
AdditionalProps = {},
RootComponent extends React.ElementType = 'div',
> = ExtendButtonBaseTypeMap<{
props: AdditionalProps & AccordionSummaryOwnProps;
defaultComponent: RootComponent;
}>;
export interface AccordionSummaryOwnerState extends Omit<
AccordionSummaryProps,
'slots' | 'slotProps'
> {}
declare const AccordionSummary: ExtendButtonBase<AccordionSummaryTypeMap>;
export type AccordionSummaryProps<
RootComponent extends React.ElementType = AccordionSummaryTypeMap['defaultComponent'],
AdditionalProps = {},
> = OverrideProps<AccordionSummaryTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
component?: React.ElementType | undefined;
};
Post-install acceptance
Run strict types, production build and real interactions. Check keyboard labels/focus, disabled/error/read-only semantics where natively supported, both themes, narrow screens and reduced motion. Verify callbacks against the real host data; do not declare installation complete from copying a prompt. Initialization fixtures also require server HTML and warning-free hydration.
Source and license
https://github.com/mui/material-ui/tree/809a7717b4c050ba3f69b75300689f07c050a16e
MIT · @mui/material@9.4.0. Vendor originals and license are preserved. Full original upstream prose remains in vendor/docs and is not represented as fully translated.