{"id":1975,"date":"2021-05-27T12:00:00","date_gmt":"2021-05-27T10:00:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/ui-ux-tutorial-for-angular-ngbootstrap-primeng-material-tree-accordion-stepper-megamenu-tabs\/"},"modified":"2026-07-05T03:25:35","modified_gmt":"2026-07-05T01:25:35","slug":"ui-ux-tutorial-for-angular-ngbootstrap-primeng-material-tree-accordion-stepper-megamenu-tabs","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/ui-ux-tutorial-for-angular-ngbootstrap-primeng-material-tree-accordion-stepper-megamenu-tabs\/","title":{"rendered":"UI\/UX Tutorial for Angular \u2013 NgBootstrap, Primeng, Material \u2013 Tree, Accordion, Stepper, Megamenu, Tabs"},"content":{"rendered":"<p>In this tutorial, you will learn how to setup and use the top 5 UI components in Angular Material, Primeng and Bootstrap. I have decided to use these three libraries so that you can choose whichever is easier for you.<\/p>\n<p>I would also teach you how to solve some of the problem you may encounter while setting up these libraries.<\/p>\n<p>Let&#8217;s begin by creating a demo project!<\/p>\n<ol>\n<li><a href=\"#t1\">Setup the Demo Projects and Install Modules<\/a><\/li>\n<li><a href=\"#t2\">Create the components and Navigation<\/a><\/li>\n<li><a href=\"#t3\">Start with NgBootstratp<\/a><\/li>\n<li><a href=\"#t4\">On to Angular Materials<\/a><\/li>\n<li><a href=\"#t5\">Let&#8217;s do Primeng!<\/a><\/li>\n<\/ol>\n<p><a href=\"https:\/\/www.youtube.com\/c\/KindsonTheTechPro\" target=\"_blank\" rel=\"noopener\">All videos in my YouTube Channel<\/a><\/p>\n<p>&nbsp;<\/p>\n<h5><strong id=\"t1\">1. Setup the Demo Project and Install Modules<\/strong><\/h5>\n<p>Create a new angular project. I named it <em>uidemo<\/em><\/p>\n<p>Add Angular material module using the command:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\">npm install @angular\/material --save\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Add Bootstrap and ngBootstrap with the command:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\">npm install bootstrap --save\r\n\r\nnpm install --save @ng-bootstrap\/ng-bootstrap \r\n<\/pre>\n<p>Finally, add the Primeng module:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\">npm install primeng --save\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Then remember to import bootstrap and Angular material into your <strong><em>styles.cs<\/em><\/strong>s file like so:<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">@import \"~bootstrap\/dist\/css\/bootstrap.css\";\r\n@import \"~angular-material\/angular-material.css\";\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h5><strong id=\"t2\">2. Setup the Components and Navigations<\/strong><\/h5>\n<p>We need to also add the Bootstrap template. So just copy a bootstrap template from the Bootstrap website into your app component.<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #007700;\">&lt;nav<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"navbar navbar-expand-md navbar-dark bg-dark mb-4\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n  <span style=\"color: #007700;\">&lt;div<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"container-fluid\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n    <span style=\"color: #007700;\">&lt;a<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"navbar-brand\"<\/span> <span style=\"color: #0000cc;\">href=<\/span><span style=\"background-color: #fff0f0;\">\"#\"<\/span><span style=\"color: #007700;\">&gt;<\/span>Top navbar<span style=\"color: #007700;\">&lt;\/a&gt;<\/span>\r\n    <span style=\"color: #007700;\">&lt;button<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"navbar-toggler\"<\/span> <span style=\"color: #0000cc;\">type=<\/span><span style=\"background-color: #fff0f0;\">\"button\"<\/span> <span style=\"color: #0000cc;\">aaria-label=<\/span><span style=\"background-color: #fff0f0;\">\"Toggle navigation\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n      <span style=\"color: #007700;\">&lt;span<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"navbar-toggler-icon\"<\/span><span style=\"color: #007700;\">&gt;&lt;\/span&gt;<\/span>\r\n    <span style=\"color: #007700;\">&lt;\/button&gt;<\/span>\r\n    <span style=\"color: #007700;\">&lt;div<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"collapse navbar-collapse\"<\/span> <span style=\"color: #0000cc;\">id=<\/span><span style=\"background-color: #fff0f0;\">\"navbarCollapse\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n      <span style=\"color: #007700;\">&lt;ul<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"navbar-nav me-auto mb-2 mb-md-0\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n        <span style=\"color: #007700;\">&lt;li<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"nav-item\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n          <span style=\"color: #007700;\">&lt;a<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"nav-link active\"<\/span> <span style=\"color: #0000cc;\">aria-current=<\/span><span style=\"background-color: #fff0f0;\">\"page\"<\/span> <span style=\"color: #0000cc;\">href=<\/span><span style=\"background-color: #fff0f0;\">\"#\"<\/span><span style=\"color: #007700;\">&gt;<\/span>Home<span style=\"color: #007700;\">&lt;\/a&gt;<\/span>\r\n        <span style=\"color: #007700;\">&lt;\/li&gt;<\/span>\r\n        <span style=\"color: #007700;\">&lt;li<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"nav-item\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n          <span style=\"color: #007700;\">&lt;a<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"nav-link\"<\/span> <span style=\"color: #0000cc;\">href=<\/span><span style=\"background-color: #fff0f0;\">\"#\"<\/span><span style=\"color: #007700;\">&gt;<\/span>Link<span style=\"color: #007700;\">&lt;\/a&gt;<\/span>\r\n        <span style=\"color: #007700;\">&lt;\/li&gt;<\/span>\r\n        <span style=\"color: #007700;\">&lt;li<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"nav-item\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n          <span style=\"color: #007700;\">&lt;a<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"nav-link disabled\"<\/span> <span style=\"color: #0000cc;\">href=<\/span><span style=\"background-color: #fff0f0;\">\"#\"<\/span> <span style=\"color: #0000cc;\">tabindex=<\/span><span style=\"background-color: #fff0f0;\">\"-1\"<\/span> <span style=\"color: #007700;\">&gt;<\/span>Disabled<span style=\"color: #007700;\">&lt;\/a&gt;<\/span>\r\n        <span style=\"color: #007700;\">&lt;\/li&gt;<\/span>\r\n      <span style=\"color: #007700;\">&lt;\/ul&gt;<\/span>\r\n      <span style=\"color: #007700;\">&lt;form<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"d-flex\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n        <span style=\"color: #007700;\">&lt;input<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"form-control me-2\"<\/span> <span style=\"color: #0000cc;\">type=<\/span><span style=\"background-color: #fff0f0;\">\"search\"<\/span> <span style=\"color: #0000cc;\">placeholder=<\/span><span style=\"background-color: #fff0f0;\">\"Search\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n        <span style=\"color: #007700;\">&lt;button<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"btn btn-outline-success\"<\/span> <span style=\"color: #0000cc;\">type=<\/span><span style=\"background-color: #fff0f0;\">\"submit\"<\/span><span style=\"color: #007700;\">&gt;<\/span>Search<span style=\"color: #007700;\">&lt;\/button&gt;<\/span>\r\n      <span style=\"color: #007700;\">&lt;\/form&gt;<\/span>\r\n    <span style=\"color: #007700;\">&lt;\/div&gt;<\/span>\r\n  <span style=\"color: #007700;\">&lt;\/div&gt;<\/span>\r\n<span style=\"color: #007700;\">&lt;\/nav&gt;<\/span>\r\n\r\n<span style=\"color: #007700;\">&lt;main<\/span> <span style=\"color: #0000cc;\">class=<\/span><span style=\"background-color: #fff0f0;\">\"container\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n<span style=\"color: #007700;\">&lt;router<\/span><span style=\"color: #0000cc;\">-outlet<\/span><span style=\"color: #007700;\">&gt;<\/span><span style=\"color: #ff0000; background-color: #ffaaaa;\">&lt;<\/span>\/router-outlet&gt;\r\n<span style=\"color: #007700;\">&lt;\/main&gt;<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Next, create your components and add navigation to the home page. You can see the video for the step by step.<\/p>\n<p>&nbsp;<\/p>\n<h5><strong id=\"t3\">3. Start with NgBootstrap. Bootstrap?<\/strong><\/h5>\n<p>First, as a rule of thumb: if you are working on an Angular project, always prefer NgBootstrap.<\/p>\n<p>Add the NgbModule to the exports section of the app.module.ts file. (See the video to see how to fix error you may encounter).<\/p>\n<p>Got to the NgBootstrap website <a href=\"https:\/\/ng-bootstrap.github.io\/#\/components\/nav\/examples\" target=\"_blank\" rel=\"noopener\">here<\/a>. You&#8217;ll find lots of examples. Let&#8217;s try some of them out!<\/p>\n<p>&nbsp;<\/p>\n<h5><strong id=\"t4\">4. On to Angular Material<\/strong><\/h5>\n<p>As a UI\/UX expert, you should know that just one library may not give you all the UI components you need. Or perhaps, one library provides a better element that the other. Or it may just be that it&#8217;s easier to implement in a particular library.<\/p>\n<p>For instance, if you are working with Dates and Times in Angular, then you should know that NgBootstrap does it better.\u00a0 That&#8217;s why I recommend you know at least how to use these libraries (Bootstrap, NgBootstrap, Angular-Material and Primeng)<\/p>\n<p>I&#8217;ll be making series of videos on how to implements various elements.<\/p>\n<p>So let&#8217;s do exactly the same tabbed panel, but this time using Angular Material<\/p>\n<ol>\n<li>Create a new component using Ng new. I call it angular-tab<\/li>\n<li>Create a route in the app-routing ts file for this component<\/li>\n<li>Add this component to the navigation<\/li>\n<li>Ensure that the MatTabsModule is added to the imports section of your app.module.ts<\/li>\n<li>Finally, copy the code for Tabs from the Angular materials example site<\/li>\n<\/ol>\n<p><strong>Note<\/strong>: If you encounter errors, you an use the command below.<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">ng update\r\n<\/pre>\n<p>Then you can do the necessary update. If the error persists, do let me know in the comment below or in the video.<\/p>\n<p>I would recommend you try out other examples yourself. Or just follow the step by step in the video.<\/p>\n<p>&nbsp;<\/p>\n<h5><strong id=\"t5\">5. On to Primeng!<\/strong><\/h5>\n<p>Primeng just like Angular Material contains a large collection of UI component. However, Primeng is considered by many to have\u00a0 a richer set of components. But as a UI\/UX expert, you should be able to choose what use to implement particular usecases.<\/p>\n<ol>\n<li>First create a new component. I call it primedemo<\/li>\n<li>Add the route for this component in the app routing module ts file<\/li>\n<li>Let&#8217;s try to do exactly the same thing here.<\/li>\n<li>So go to the Primefaces website and copy the code for TabbedPanel.<\/li>\n<\/ol>\n<p>Follow the steps in the video to complete this one.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to setup and use the top 5 UI components in Angular Material, Primeng and Bootstrap. I have decided &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[414],"tags":[],"class_list":["post-1975","post","type-post","status-publish","format-standard","hentry","category-programming"],"acf":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=1975"}],"version-history":[{"count":1,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1975\/revisions"}],"predecessor-version":[{"id":2143,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1975\/revisions\/2143"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=1975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=1975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=1975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}