# Expansion Panel

You can add the component on any page in the template. You need to follow the steps given below:&#x20;

**Step 1:** You need to create a state and function to handle it's event. Also you need to add the code of expansion panel in the page where you want to add the component. Please check the code snippet given below, we have added the expansion panel in the Ecommerce Dashboard:

```
/**
 * Ecommerce Dashboard
 */

import React, { Component } from 'react'
...

export default class EcommerceDashboard extends Component {
    // Expansion Panel State
	state = {
		expanded: null,
	};
	
	// Expansion Panel Function
	handleChange = panel => (event, expanded) => {
		this.setState({
			expanded: expanded ? panel : false,
		});
	};
	render() {
		...
		return (
			<div className="ecom-dashboard-wrapper">
				...
						// Expansion Panel Code
						<div>
							<ExpansionPanel>
								<ExpansionPanelSummary expandIcon={<i className="zmdi zmdi-chevron-down"></i>}>
									<Typography>Expansion Panel 1</Typography>
								</ExpansionPanelSummary>
								<ExpansionPanelDetails>
									<Typography>
										Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
							sit amet blandit leo lobortis eget.
							</Typography>
								</ExpansionPanelDetails>
							</ExpansionPanel>
							<ExpansionPanel>
								<ExpansionPanelSummary expandIcon={<i className="zmdi zmdi-chevron-down"></i>}>
									<Typography>Expansion Panel 2</Typography>
								</ExpansionPanelSummary>
								<ExpansionPanelDetails>
									<Typography>
										Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
							sit amet blandit leo lobortis eget.
							</Typography>
								</ExpansionPanelDetails>
							</ExpansionPanel>
							<ExpansionPanel disabled>
								<ExpansionPanelSummary expandIcon={<i className="zmdi zmdi-chevron-down"></i>}>
									<Typography>Disabled Expansion Panel</Typography>
								</ExpansionPanelSummary>
							</ExpansionPanel>
						</div>
					</div>
```

**Step 2:** Now Import the component from its parent library.

```
import ExpansionPanel from '@material-ui/core/ExpansionPanel';
import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
import Typography from '@material-ui/core/Typography';
```

We have given you an example of adding an expansion panel on the Ecommerce Dashboard.

![](https://3423697845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEnOfkACC-WsXr2rO7I%2F-LbwY8BSY4Ahtf5JKcvK%2F-Lbwd_li_Zyt8sRDmaqH%2FSelection_038.png?alt=media\&token=76107782-9bcb-4f80-ad9b-9415fd013342)

You can check some other layouts of expansion panel below. For adding any of the below layout in the template, please check their relative code in the `src->routes->components->expansion-panel->components` folder.

![](https://3423697845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEnOfkACC-WsXr2rO7I%2F-LbvN6B07613ig8EZ-kb%2F-LbvNlPmt-nLgGKdwg5l%2FScreenshot%202019-04-08%20at%2010.14.54%20AM.png?alt=media\&token=52858f47-a34f-4a54-a0df-91d00aefd581)

![](https://3423697845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEnOfkACC-WsXr2rO7I%2F-LbvN6B07613ig8EZ-kb%2F-LbvNn-ITilVo1EyClCL%2FScreenshot%202019-04-08%20at%2010.15.04%20AM.png?alt=media\&token=4a00c03f-d4e0-4b1f-83f3-26bfcf0dc0bc)
