Skip to main content

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.

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",
}];
}

Attributes

AttributeTypeUseExample
logo-srcstringOptional 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.
<foundation-header logo-src="path/to/logo.png">
logo-alt-textstringOptional attribute which controls the alt text of the logo. If this attribute is not set then the alt text is set to 'Corporate Logo'.
<foundation-header logo-alt-text="My Logo">
show-luminance-toggle-buttonbooleanBoolean attribute which controls whether the navigation bar will display the luminance toggle icon.
<foundation-header show-luminance-toggle-button>
show-misc-toggle-buttonbooleanBoolean attribute which controls whether the navigation bar will display the miscellaneous behaviour icon.
<foundation-header show-misc-toggle-button>
show-notification-buttonbooleanBoolean attribute which controls whether the navigation bar will display the show notification icon.
<foundation-header show-notification-button>
show-connection-indicatorbooleanBoolean attribute which controls whether the navigation bar will display the connection indicator.
foundation-header show-connection-indicator>
show-language-selectorbooleanBoolean attribute which controls whether the navigation bar will display the language selector.
<foundation-header show-language-selector>
hide-side-barbooleanBoolean attribute which controls whether the navigation bar will display the side bar.
  <foundation-header hide-side-bar>

Properties

PropertyTypeUseExample
userNamestringUsername of the logged in user.
<foundation-header :userName="${(x) => x.userName}>
languageOptionsLanguageOptionsObject which defines the language options to be displayed in the language selector.
<foundation-header :languageOptions="${(x) => x.languageOptions}>
routeNavItemsFoundationRouteNavItem[]Array of FoundationRouteNavItems which define the route buttons to be displayed in the navigation bar.
<foundation-header :routeNavItems="${(x) => x.routeNavItems}">

Slots

Slot NameDescription
menu-contentsSlot for adding custom content to the flyout menu (side navigation).
routesSlot for adding custom route buttons to the navigation bar.
routes-endSlot for adding custom route buttons to the end of the navigation bar.

Parts

Part NameDescription
dynamic-templateThe element representing the dynamic template content.

Methods

Method NameDescription
logoutLogs the user out of their session.
navigateToChanges the route of the current page.

Fired Events

Event NameTypeDescriptionExample
luminance-icon-clickedvoidDispatched when the user clicks on the luminance toggle icon in the navigation bar.
  <foundation-header @luminance-icon-clicked="${(x) => x.handleLuminanceIconClick}>
misc-icon-clickedvoidDispatched when the user clicks on the miscellaneous behaviour icon in the navigation bar.
<foundation-header @misc-icon-clicked="${(x) => x.handleMiscIconClick}">
notification-icon-clickedvoidDispatched when the user clicks on the notification icon in the navigation bar.
<foundation-header @notification-icon-clicked="${(x) => x.handleNotificationIconClick}">
language-changedvoidDispatched when the user changes the language in the language selector.
<foundation-header @language-changed="${(x) => x.handleLanguageChange}">
info

For a full list of attributes and properties, see API documents.