# Selection Controls

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 checkbox in the page where you want to add the component. Please check the code snippet given below, we have added the checkbox in the Ecommerce Dashboard:

```
/**
 * Ecommerce Dashboard
 */

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

export default class EcommerceDashboard extends Component {
	// Checkbox State
	state = {
		checkedA: false,
	};

	// Checkbox Function
	handleChange = name => (event, checked) => {
		this.setState({ [name]: checked });
	};

	render() {
		....
						// Checkbox Code
						<div>
						<FormGroup>
							<FormControlLabel control={
								<Checkbox color="primary" checked={this.state.checkedA} onChange={this.handleChange('checkedA')} value="checkedA" />
							} label="Option A"
							/>
						</FormGroup>
						</div>
					...
```

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

```
import FormGroup from '@material-ui/core/FormGroup';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Checkbox from '@material-ui/core/Checkbox';
```

We have given you an example of adding a simple checkbox on the Ecommerce Dashboard.

![](https://3423697845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEnOfkACC-WsXr2rO7I%2F-Lbwg9fppjOWdgXHEgIf%2F-Lbwjkr2V9K9xFxdmh75%2FSelection_044.png?alt=media\&token=d7170127-809d-4b11-9f30-09d56bc4ee5b)

You can check some other layouts of checkbox below. For adding any of the below layout in the template, please check their relative code in the `src->routes->components->selection-controls->index.js` file.

![](https://3423697845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEnOfkACC-WsXr2rO7I%2F-LbvP11UgKU4MlVzPa8h%2F-LbvVr4juKnXB6HVo9k0%2FScreenshot%202019-04-08%20at%2011.22.24%20AM.png?alt=media\&token=e86c7198-f66c-4d76-b489-939c62971a06)

![](https://3423697845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEnOfkACC-WsXr2rO7I%2F-LbvP11UgKU4MlVzPa8h%2F-LbvVu4Clj5mRm1OKnUA%2FScreenshot%202019-04-08%20at%2011.22.39%20AM.png?alt=media\&token=cf179140-ee7f-4c10-8b26-0bb58c3a5fb5)

![](https://3423697845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEnOfkACC-WsXr2rO7I%2F-LbvP11UgKU4MlVzPa8h%2F-LbvVu4ECm33QD_YF0Hr%2FScreenshot%202019-04-08%20at%2011.22.53%20AM.png?alt=media\&token=8a134b61-300c-4958-ba2f-27001e9951c6)
