Precision Healthcare Solutions
CLINICAL OFFICE MPAGE SUITE DEVELOPER REPORTS DESIGNER shopping_cart mail
SALES CONTACT US
TutorialsWorkflow Component1. Getting Started2. Data Retrieval3. Tabbed Menu4. Building Reusable Parts5. Information Tab6. Relationship Tab7. Provider Relationship Tab8. Final StepsFull Page MPage1. Getting Started2. User Prompts3. Custom Script - Part 14. Add a Table5. Click to View Details6. Custom Script - Part 27. Add Remaining Details8. Bonus - Deploy to DA2Third Party IntegrationExcelJS

Tabbed Menu

Our patient information component will display multiple screens of information through the use of a tabbed menu bar and an Angular component created for each view. In this tutorial, we will create a tab called Information, Relationships, and Provider Relationships. With the information learned here, you should be able to expand this to meet your specific hospital needs with additional information from other data sources.

Steps

  1. Import IMenuItem and TabbedMenuComponent from @clinicaloffice/mpage-developer in your app.ts file. This import can be in the same import statement as the other Clinical Office services currently being imported.
  2. Add TabbedMenuComponent to the imports array on the component decorator.
    @Component({
        selector: 'app-root',
        imports: [MpageLogComponent, TabbedMenuComponent],
        templateUrl: './app.html',
        standalone: true,
        ....
    })
    
  3. In your class export, add a public object called menuItems. I've located it right after the path InputSignal and before ngOnInit(), but this code can be anywhere inside your class definition. menuItems will be an array of IMenuItem values.
    public menuItems: IMenuItem[] = [
        { label: 'Information', idName: 'info', icon: 'contact_mail' },
        { label: 'Relationships', idName: 'reltionships', icon: 'people' },
        { label: 'Provider Relationships', idName: 'provider-relationships', icon: 'handshake' }
    ];
  4. We are going to add a little custom styling to our menu. Open the styles.scss file in your src folder and add the following content at the bottom of the file. When we render our menu bar, we want to see a solid line across the entire width of the screen.
    /* Custom Styles for this Page */
    .menu  {
      border-bottom: 2px solid var(--primary-color);
    }
  5. Open app.html. We are going to add a loading message and render our menu bar once the CCL content has been loaded. Replace all code in app.html with the following.
    @if (!common.ready()) {
    <h2>Please Wait...Retrieving Patient Record.</h2>
    } @else {
    <div class="flex menu">
        <tabbed-menu [tabs]="menuItems" />
    </div>
    }
    
    <mpage-log-component [properties]="{position: 'inline'}" />

    This code does several things. First, the @if (!common.ready()) block displays a message if our ready signal is false and once true, it displays our menu.

    Angular Signals will automatically refresh the content of any component (and child-component) if the value in the Signal has been modified. When our page first renders, ready is false. As the data from CCL returns, our callback function we wrote in our common service assigns true to the ready value. As soon as this happens, Angular Signals notify all components where the Signal has been used to refresh the display.

  6. Return to your browser and see your new menu.
  7. If you click your menu tabs, the highlighted menu item will change, however, it does nothing else. We need to store the menu state.

    Return to app.ts and add signal and WritableSignal to the import statement from @angular/core.

    import { ChangeDetectionStrategy, Component, inject, input, InputSignal, OnInit, ViewEncapsulation, signal, WritableSignal } from '@angular/core';

  8. Add a new public variable called selectedMenu. This variable will be a type of WritableSignal<IMenuItem> and will be defaulted with the first entry in our menuItems array. Place this immediately after your definition for menuItems.
    public selectedMenu: WritableSignal<IMenuItem> = signal(this.menuItems[0]);
  9. Return to app.html and modify your tabbed-menu code to include the clickTab emitter. The code below will assign the clicked tab menu value to our selectedMenu signal every time a menu item is chosen.
    <tabbed-menu [tabs]="menuItems" (clickTab)="selectedMenu.set($event)" />
  10. To simplify things, we are going to create components for all three of our tabs at once. Using the Angular CLI, type in ng g c or ng generate component followed by a folder name of components and the names information, relationships, and providers.
  11. Open the .ts files for each of the new components and add standalone: true to the @Component decorator.
  12. In app.ts, import each of the new components.
    import { Information } from './components/information/information';
    import { Relationships } from './components/relationships/relationships';
    import { Providers } from './components/providers/providers';
  13. Update the imports array in the @Component decorator with the three new components.
    @Component({
        selector: 'app-root',
        imports: [MpageLogComponent, TabbedMenuComponent, Information, Relationships, Providers],
        templateUrl: './app.html',
        ....
    })
  14. Modify app.html to include a @switch statement that renders the correct component based on the tab that is chosen by the user.
    @if (!common.ready()) {
        <h2>Please Wait...Retrieving Patient Record.</h2>
    } @else {
        <div class="flex menu">
            <tabbed-menu [tabs]="menuItems" (clickTab)="selectedMenu.set($event)" />
        </div>
    
        @switch (selectedMenu().idName) {
            @case('info') { <app-information /> }
            @case('reltionships') { <app-relationships /> }
            @case('provider-relationships') { <app-providers /> }
        }
    }
    
    <mpage-log-component [properties]="{position: 'inline'}" />
  15. Return to your browser to view your full functional menu system in action.
<< Prev: 2. Data Retrieval
Next: 4. Building Reusable Parts >>
Copyright © 2026 Precision Healthcare Solutions