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, language switching, and an optional Feature Flags selector for URL feature.* toggles.

It supports nested navigation permissions and layout item active indicators for route nav items.

The navigation bar reflects the current route: the active top-level item (and nested child row, when applicable) receives selected styling based on pathname polling. To detect whether a nav item should appear active in custom templates, use hasActiveChild. You can change the highlight with the --foundation-header-selected-item-background design token: pick any colour you want, or remove the highlight by matching the normal button fill or using transparent where appropriate; see Selected route highlight colour in Customizing the header.

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:

<FoundationHeader></FoundationHeader>

Usage:

import { FoundationHeader } from '@genesislcap/foundation-header/react';

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 (
<FoundationHeader
routeNavItems={navItems}
></FoundationHeader>
);
}

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-environment-indicatorbooleanBoolean attribute which controls whether the navigation bar will display the environment indicator. See Environment Indicator for configuration details.
<foundation-header show-environment-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>
enable-inactivity-monitoringbooleanBoolean attribute which controls whether client side inactivity monitoring is enabled. - Defaults to true
<foundation-header enable-inactivity-monitoring>
inactivity-timeout-minutesstringAttribute which controls the duration of inactivity within the app before the inactivity warning dialog is shown to the user. Requires enable-inactivity-monitoring - Defaults to 30
<foundation-header inactivity-timeout-minutes="20">
inactivity-warning-minutesstringAttribute which controls the duration that the warning dialog is shown to the user, before the user is logged out. Requires enable-inactivity-monitoring - Defaults to 5
<foundation-header inactivity-warning-minutes="2">

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}>
featureFlagOptionsFeatureFlagOptionsObject which defines the feature flags offered in the header selector. Populate availableFlags to show the Feature Flags button; an empty list keeps it hidden. Selected flags sync to URL feature.* query params and reload the page. See Feature flags.
<foundation-header :featureFlagOptions="${(x) => x.featureFlagOptions}">
routeNavItemsFoundationRouteNavItem[]Array of FoundationRouteNavItems which define the route buttons to be displayed in the navigation bar, including nested submenu items. Permission checks apply to nested items as well as top-level items.
<foundation-header :routeNavItems="${(x) => x.routeNavItems}">
layoutItemCheck(registration: string) => boolean(BETA) Callback used to determine if a layout nav item is currently active. Works with nav items that set isLayoutItem and layoutRegistration.
<foundation-header
:layoutItemCheck="${(x) => (registration) => x.currentLayoutItems.includes(registration)}"
>

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.
feature-flags-wrapperWrapper around the Feature Flags control. See Feature flags.
feature-flags-buttonThe Feature Flags button.
feature-flags-panelThe Feature Flags panel that hosts the multiselect.

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}">
feature-flags-changedstring[]Dispatched when the user changes the selected feature flags. Detail is the array of selected flag names. The header then updates URL feature.* params and reloads.
<foundation-header @feature-flags-changed="${(x, c) => x.handleFeatureFlagsChange(c.event)}">
logout-clickedvoidDispatched when the user clicks logout button.
<foundation-header @logout-clicked="${(x) => x.handleLagoutClicked}">
info

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