Ionic Side Menu
Learn how to use and customize a sid menu component in an Ionic angular app.
Last updated
Learn how to use and customize a sid menu component in an Ionic angular app.
Last updated
Navigation is indeed one of the most important elements of user experience. The Menu component is a navigation drawer that slides in from one side of the current view. In Ionic apps is very easy to add a Side Menu component.
By default, it slides in from the left, but the side can be overridden. This is important for RTL apps.
After you go through the authentication pages of the template and you log in into the app, you will see that there are two ways to navigate into the app pages:
tabs
side menu
To learn more about the navigations used in this ionic template go to the Navigation section.
You can find the code of this side menu insrc/app/app.component.html
and src/app/app.component.ts
We use the ion-menu component from the Ionic UI Components. You can either define the menu items in the markup (.html) or in the component (.ts).
Let's see an example.
The following code defines the Forms section of the ion-menu
with two items.
With the [routerLink]
you define the route where you want to navigate to when clicking the ion-item
.
Remember that those routes are defined in src/app/app-routing.module.ts
The icons can be set either using Ionicons, like we do in the Form Filters option, or using custom svg icons. This template includes lots of custom and beautiful svg icons that you can use in your ionic apps.
Also, other menu item options are defined as a list in the AppComponent
and iterated in the html. Let's see an example.