Accordion

The Accordion component lets users show and hide sections of related content on a page.

<Accordion>
<AccordionSummary helperText="Helper Text" expandIcon={<ArrowDown />} aria-controls="panel1d-content" id="panel1d-header">
<Typography variant="h4" component="h4">Accordion #1</Typography>
</AccordionSummary>
<AccordionDetails>
<Typography>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor
sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
sit amet blandit leo lobortis eget.
</Typography>
</AccordionDetails>
</Accordion>
<Accordion>
<AccordionSummary helperText="Helper Text" expandIcon={<ArrowDown />} aria-controls="panel1d-content" id="panel1d-header">
<Typography variant="h4" component="h4">Accordion #2</Typography>
</AccordionSummary>
<AccordionDetails>
<Typography>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor
sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
sit amet blandit leo lobortis eget.
</Typography>
</AccordionDetails>
</Accordion>

Props

PropTypeDefaultDescription
actionReactNodeThe content of the component.
childrenReactNodeThe content of the component.
classesobjectOverride or extend the styles applied to the component.
defaultExpandedbooleanIf true, expands the accordion by default.
disabledbooleanIf true, the component is disabled.
disableGuttersbooleanIf true, it removes the margin between two expanded accordion items and the increase of height.
expandedbooleanIf true, expands the accordion, otherwise collapse it. Setting this prop enables control over the accordion.

The ref is forwarded to the root element.

Examples

Accordion with Switches

<Accordion disableGutters elevation={0}>
<AccordionSummary helperText="Helper Text" expandIcon={<ArrowDown />} aria-controls="panel1d-content" id="panel1d-header">
<Typography variant="h4" component="h4">
<Switch />Switch #1
</Typography>
</AccordionSummary>
<AccordionDetails>
<div style={{ paddingLeft: 32 }}>
<MenuItem value="Ten">
<Checkbox checked={true} />
<ListItemText primary="Ten" />
</MenuItem>
<MenuItem value="Twenty">
<Checkbox checked={true} />
<ListItemText primary="Twenty" />
</MenuItem>
<MenuItem value="Thirty">
<Checkbox checked={false} />
<ListItemText primary="Thirty" />
</MenuItem>
<MenuItem value="Forty">
<Checkbox checked={true} />
<ListItemText primary="Forty" />
</MenuItem>
</div>
</AccordionDetails>
</Accordion>
<Accordion disableGutters elevation={0}>
<AccordionSummary helperText="Helper Text" expandIcon={<ArrowDown />} aria-controls="panel1d-content" id="panel1d-header">
<Typography variant="h4" component="h4">
<Switch />Switch #1
</Typography>
</AccordionSummary>
<AccordionDetails>
<div style={{ paddingLeft: 32 }}>
<FormControl component="fieldset">
<FormControlLabel
value="disabled1"
control={<Radio />}
label="Selected disabled option"
/>
<FormControlLabel
value="disabled2"
control={<Radio />}
label="Unselected disabled option"
/>
</FormControl>
</div>
</AccordionDetails>
</Accordion>

Accordion with CheckBox

<Accordion disableGutters elevation={0}>
<AccordionSummary helperText="Helper Text" expandIcon={<ArrowDown />} aria-controls="panel1d-content" id="panel1d-header">
<Typography variant="h4" component="h4">
<Checkbox />CheckBox #1
</Typography>
</AccordionSummary>
<AccordionDetails>
<div style={{ paddingLeft: 32 }}>
<MenuItem value="Ten">
<Checkbox checked={true} />
<ListItemText primary="Ten" />
</MenuItem>
<MenuItem value="Twenty">
<Checkbox checked={true} />
<ListItemText primary="Twenty" />
</MenuItem>
<MenuItem value="Thirty">
<Checkbox checked={false} />
<ListItemText primary="Thirty" />
</MenuItem>
<MenuItem value="Forty">
<Checkbox checked={true} />
<ListItemText primary="Forty" />
</MenuItem>
</div>
</AccordionDetails>
</Accordion>
<Accordion disableGutters elevation={0}>
<AccordionSummary helperText="Helper Text" expandIcon={<ArrowDown />} aria-controls="panel1d-content" id="panel1d-header">
<Typography variant="h4" component="h4">
<Checkbox />CheckBox #2
</Typography>
</AccordionSummary>
<AccordionDetails>
<div style={{ paddingLeft: 32 }}>
<FormControl component="fieldset">
<FormControlLabel value="disabled1" control={<Radio />} label="Selected disabled option" />
<FormControlLabel value="disabled2" control={<Radio />} label="Unselected disabled option" />
</FormControl>
</div>
</AccordionDetails>
</Accordion>