Foundation Header
foundation-header is a micro front-end consisting of a navigation bar and a flyout menu, with routing, account-logout capabilities, and the ability to change the current language.
Adding a header component to the template
Here is an example of a simple navigation bar with two navigation items. This header does not show additional control buttons but displays the default ones, allowing for showing submenus, the logged-in user's name, and the connection status.
- Genesis
- React
- Angular
Declaration:
  <foundation-header></foundation-header>
Usage:
@customElement({
  name: 'header-example',
  template: html`
    <foundation-header
      :routeNavItems=${(x) => x.navItems}
    ></foundation-header>
  `,
})
export class HeaderExample extends GenesisElement {
  const navItems = [{
    title: "Home",
    icon: {
      name: "home",
      variant: "solid",
    },
    navId: "header",
    placementIndex: 0,
    routePath: "home",
    routeName: "home",
  },
  {
    title: "Grids",
    icon: {
        name: "table",
        variant: "solid",
      },
    navId: "header",
    placementIndex: 1,
    routePath: "grids",
    routeName: "grids",
  }];
}
Declaration:
  <foundation-header></foundation-header>
Usage:
export default function HeaderExample({}) {
  const navItems = [{
    title: "Home",
    icon: {
      name: "home",
      variant: "solid",
    },
    navId: "header",
    placementIndex: 0,
    routePath: "home",
    routeName: "home",
  },
  {
    title: "Grids",
    icon: {
        name: "table",
        variant: "solid",
      },
    navId: "header",
    placementIndex: 1,
    routePath: "grids",
    routeName: "grids",
  }];
  return (
    <foundation-header
      routeNavItems={navItems}
    ></foundation-header>
  );
}
Declaration:
  <foundation-header></foundation-header>
Usage
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
  selector: 'header-example',
  template: `
    <foundation-header
      [routeNavItems]="navItems"
    ></foundation-header>
  `,
  standalone: true,
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class HeaderExampleComponent {
  navItems = [{
    title: "Home",
    icon: {
      name: "home",
      variant: "solid",
    },
    navId: "header",
    placementIndex: 0,
    routePath: "home",
    routeName: "home",
  },
  {
    title: "Grids",
    icon: {
        name: "table",
        variant: "solid",
      },
    navId: "header",
    placementIndex: 1,
    routePath: "grids",
    routeName: "grids",
  }];
}
Attributes
| Attribute | Type | Use | Example | 
|---|---|---|---|
| logo-src | string | Optional attribute which sets the source of the image in the navigation bar and flyout menu. The Genesis logo will be shown if this attribute is not provided. |  | 
| logo-alt-text | string | Optional attribute which controls the alt text of the logo. If this attribute is not set then the alt text is set to 'Corporate Logo'. |  | 
| show-luminance-toggle-button | boolean | Boolean attribute which controls whether the navigation bar will display the luminance toggle icon. |  | 
| show-misc-toggle-button | boolean | Boolean attribute which controls whether the navigation bar will display the miscellaneous behaviour icon. |  | 
| show-notification-button | boolean | Boolean attribute which controls whether the navigation bar will display the show notification icon. |  | 
| show-connection-indicator | boolean | Boolean attribute which controls whether the navigation bar will display the connection indicator. |  | 
| show-environment-indicator | boolean | Boolean attribute which controls whether the navigation bar will display the environment indicator. See Environment Indicator for configuration details. |  | 
| show-language-selector | boolean | Boolean attribute which controls whether the navigation bar will display the language selector. |  | 
| hide-side-bar | boolean | Boolean attribute which controls whether the navigation bar will display the side bar. |  | 
Properties
| Property | Type | Use | Example | 
|---|---|---|---|
| userName | string | Username of the logged in user. |  | 
| languageOptions | LanguageOptions | Object which defines the language options to be displayed in the language selector. |  | 
| routeNavItems | FoundationRouteNavItem[] | Array of FoundationRouteNavItems which define the route buttons to be displayed in the navigation bar. |  | 
Slots
| Slot Name | Description | 
|---|---|
| menu-contents | Slot for adding custom content to the flyout menu (side navigation). | 
| routes | Slot for adding custom route buttons to the navigation bar. | 
| routes-end | Slot for adding custom route buttons to the end of the navigation bar. | 
Parts
| Part Name | Description | 
|---|---|
| dynamic-template | The element representing the dynamic template content. | 
Methods
| Method Name | Description | 
|---|---|
| logout | Logs the user out of their session. | 
| navigateTo | Changes the route of the current page. | 
Fired Events
| Event Name | Type | Description | Example | 
|---|---|---|---|
| luminance-icon-clicked | void | Dispatched when the user clicks on the luminance toggle icon in the navigation bar. |  | 
| misc-icon-clicked | void | Dispatched when the user clicks on the miscellaneous behaviour icon in the navigation bar. |  | 
| notification-icon-clicked | void | Dispatched when the user clicks on the notification icon in the navigation bar. |  | 
| language-changed | void | Dispatched when the user changes the language in the language selector. |  | 
| logout-clicked | void | Dispatched when the user clicks logout button. |  | 
info
For a full list of attributes and properties, see API documents.