2016-05-23 12:13:30 +03:00
---
title: Sidebar
author: vl
sort: 900
group: Components
template: article.jade
---
Sidebar is used to provide convenient way of navigation in the application.
2016-05-25 14:35:19 +03:00
Application supports only one sidebar per angular application.
2016-05-23 12:13:30 +03:00
That means sidebar is basically a singletone object.
Currently sidebar supports level 1 and 2 sub menus.
2016-05-24 13:29:46 +03:00
Sidebar can be added to the page using `BaSidebar` component:
2016-05-23 12:13:30 +03:00
```html
< ba-sidebar > < / ba-sidebar >
```
2016-05-24 13:29:46 +03:00
At the moment sidebar menu items configuration and Angular 2 Router should be configured independently. We probably will come up with a better solution once new Angular Router is released and stable.
2016-05-23 12:13:30 +03:00
2016-05-24 13:29:46 +03:00
## Menu Configuration
2016-05-23 12:13:30 +03:00
2016-05-25 14:35:19 +03:00
All menu items are located inside `src/app/app.menu.ts` file. The file contains a list of Menu Item objects with the following fields:
2016-05-23 12:13:30 +03:00
```javascript
2016-05-24 13:29:46 +03:00
{
title: 'Dashboard', // menu item title
component: 'Dashboard', // component where the menu should lead, has a priority over url property
url: 'http://google.com' // manual url address (used only when component is not specified)
icon: 'ion-android-home', // icon class
target: '_blank', // link target attribute (used only when url is specified)
selected: false, // is item selected
expanded: false, // is item expanded (used only when subItems list specified)
order: 0 // order in a list
}
2016-05-23 12:13:30 +03:00
```
2016-05-24 13:29:46 +03:00
You also can define a list of sub-menu items like this:
2016-05-23 12:13:30 +03:00
```javascript
2016-05-24 13:29:46 +03:00
{
title: 'Charts',
component: 'Charts',
icon: 'ion-stats-bars',
selected: false,
expanded: false,
order: 200,
subMenu: [ // list of sub-menu items
{
title: 'Chartist.Js', // sub-item title
component: 'ChartistJs' // sum-item component
},
]
}
2016-05-23 12:13:30 +03:00
```
2016-05-24 13:29:46 +03:00
## Routes configuration
2016-05-23 12:13:30 +03:00
2016-05-24 13:54:31 +03:00
Routes configuration is specified in the Page Components according to Angular 2 Router specification. More information you can find [here ](https://angular.io/docs/ts/latest/guide/router-deprecated.html ).