Canopy Header — Best Practices
SkillCommunicationBest practices for the Canopy Header component. Trigger when adding a site header, primary navigation, account menu, notification badge, or logo in an Angular project using Canopy.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Canopy Header — Best Practices skill
What this skill tells your AI
The instructions your AI receives, as published by legal-and-general/canopy in skills/best-practice/header/SKILL.md and read by ahel’s review.
This skill provides usage guidance and input reference for the Canopy header components from @legal-and-general/canopy.
Apply this skill whenever you use the lg-header attribute selector or LgHeaderComponent.
Import
import {
LgHeaderComponent,
LgHeaderLogoComponent,
LgPrimaryNavComponent,
LgPrimaryNavListItemComponent,
LgPrimaryNavItemDirective,
LgPrimaryNavMobileItemDirective,
LgAccountMenuComponent,
LgAccountMenuListItemComponent,
LgAccountMenuItemDirective,
LgAccountMenuItemLabelComponent,
LgAccountMenuMobileItemDirective,
LgNotificationBadgeComponent,
LgLinkMenuItemComponent,
LgLinkMenuItemTextComponent,
} from '@legal-and-general/canopy';
Basic Usage
The header uses an attribute selector — apply lg-header to a native <header> element.
<header lg-header>
<lg-header-logo src="/assets/logo.svg" alt="Company name" href="/"></lg-header-logo>
</header>
Co-branding
Use two lg-header-logo components side by side for a co-branded header:
<header lg-header>
<lg-header-logo src="/assets/lg-logo.svg" alt="Legal & General" href="/"></lg-header-logo>
<lg-header-logo src="/assets/partner-logo.svg" alt="Partner name" href="/"></lg-header-logo>
</header>
With Primary Navigation and Account Menu
The navigation has two separate sets of items — one for desktop (lg breakpoint and above) and one for mobile (below lg). Both must be explicitly provided.
- Desktop items: use
lg-primary-nav-list-item+lgPrimaryNavItem - Mobile primary nav items: use
lgPrimaryNavMobileItem+lg-link-menu-itemstructure, projected insidelg-primary-nav - Mobile account menu items: use
lgAccountMenuMobileItem+lg-link-menu-itemstructure, also projected insidelg-primary-nav - Desktop account menu items: use
lg-account-menu+lg-account-menu-list-item+lgAccountMenuItem— these are always visible in the header bar
<header lg-header>
<lg-header-logo [src]="logo" [alt]="logoAlt" [href]="logoHref"></lg-header-logo>
<lg-notification-badge lgMenuBadge variant="dot" accessText="You have unread messages"></lg-notification-badge>
<lg-primary-nav>
<!-- Desktop navigation items (visible at lg+) -->
<lg-primary-nav-list-item>
<a href="/" [isActive]="true" lgPrimaryNavItem>Link 1</a>
</lg-primary-nav-list-item>
<lg-primary-nav-list-item>
<a href="/products" lgPrimaryNavItem>
Link 2
<lg-notification-badge count="3" accessText="You have 3 unread messages"></lg-notification-badge>
</a>
</lg-primary-nav-list-item>
<!-- Mobile primary nav items (visible below lg) -->
<a lgPrimaryNavMobileItem href="/">
<lg-link-menu-item>
<lg-link-menu-item-text>Link 1</lg-link-menu-item-text>
</lg-link-menu-item>
</a>
<a lgPrimaryNavMobileItem href="/products">
<lg-link-menu-item>
<lg-link-menu-item-text>Link 2</lg-link-menu-item-text>
<lg-notification-badge count="3" accessText="You have 3 unread messages"></lg-notification-badge>
</lg-link-menu-item>
</a>
<!-- Mobile account menu items (visible below lg, projected into nav dropdown) -->
<a lgAccountMenuMobileItem href="/account">
<lg-link-menu-item>
<lg-link-menu-item-text>Account</lg-link-menu-item-text>
</lg-link-menu-item>
</a>
<a lgAccountMenuMobileItem href="/sign-out">
<lg-link-menu-item>
<lg-link-menu-item-text>Sign out</lg-link-menu-item-text>
</lg-link-menu-item>
</a>
</lg-primary-nav>
<!-- Account menu items visible in header bar on mobile and desktop -->
<lg-account-menu>
<lg-account-menu-list-item>
<a href="/account" lgAccountMenuItem>
<lg-account-menu-item-label>Account</lg-account-menu-item-label>
<lg-icon name="profile"></lg-icon>
</a>
</lg-account-menu-list-item>
<lg-account-menu-list-item>
<a href="/sign-out" lgAccountMenuItem>
<lg-account-menu-item-label>Sign out</lg-account-menu-item-label>
<lg-icon name="sign-in"></lg-icon>
</a>
</lg-account-menu-list-item>
</lg-account-menu>
</header>
Co-branded with Navigation
Combine two lg-header-logo elements with the full navigation structure:
<header lg-header>
<lg-header-logo [src]="logo" [alt]="logoAlt" [href]="logoHref"></lg-header-logo>
<lg-header-logo [src]="secondaryLogo" [alt]="secondaryLogoAlt" [href]="secondaryLogoHref"></lg-header-logo>
<lg-notification-badge lgMenuBadge variant="dot" accessText="You have unread messages"></lg-notification-badge>
<lg-primary-nav>
<lg-primary-nav-list-item>
<a href="/" [isActive]="true" lgPrimaryNavItem>Link 1</a>
</lg-primary-nav-list-item>
<a lgPrimaryNavMobileItem href="/">
<lg-link-menu-item>
<lg-link-menu-item-text>Link 1</lg-link-menu-item-text>
</lg-link-menu-item>
</a>
<a lgAccountMenuMobileItem href="/account">
<lg-link-menu-item>
<lg-link-menu-item-text>Account</lg-link-menu-item-text>
</lg-link-menu-item>
</a>
</lg-primary-nav>
<lg-account-menu>
<lg-account-menu-list-item>
<a href="/account" lgAccountMenuItem>
<lg-account-menu-item-label>Account</lg-account-menu-item-label>
<lg-icon name="profile"></lg-icon>
</a>
</lg-account-menu-list-item>
</lg-account-menu>
</header>
Inputs & Outputs
LgHeaderComponent
| Output | Type | Description |
|---|---|---|
menuToggled | EventEmitter<boolean> | Emitted when the mobile menu toggle button is clicked. |
Content slots
| Selector | Description |
|---|---|
lg-header-logo | Projects one or more logo elements into the logos wrapper at the start of the header bar. |
[lgMenuBadge] | Projects content (typically lg-notification-badge) into the burger toggle button; hidden when the menu is open. |
| (default) | Projects all other content (e.g. lg-primary-nav, lg-account-menu) into the main header wrapper. |
LgHeaderLogoComponent
| Input | Type | Default | Required | Description |
|---|---|---|---|---|
src | string | — | Yes | Logo image URL. |
alt | string | '' | Yes | Alt text for the logo image. |
href | string | — | No | URL link if the logo is clickable. |
LgPrimaryNavComponent
| Input | Type | Default | Required | Description |
|---|---|---|---|---|
showResponsiveMenu | boolean | false | No | Shows or hides the responsive mobile menu. |
LgPrimaryNavListItemComponent
| Input | Type | Default | Required | Description |
|---|---|---|---|---|
alignRight | boolean | false | No | Aligns the item to the right-hand side at lg breakpoints. |
| Output | Type | Description |
|---|---|---|
tabbedOut | EventEmitter<KeyboardEvent> | Emitted when the tab key bubbles up to the list item. |
clicked | EventEmitter<Event> | Emitted when a click event bubbles up to the list item. |
LgPrimaryNavItemDirective
| Input | Type | Default | Required | Description |
|---|---|---|---|---|
isActive | boolean | false | No | Sets the active state of the navigation item. |
LgAccountMenuItemDirective
| Input | Type | Default | Required | Description |
|---|---|---|---|---|
isActive | boolean | false | No | Sets the active state of the account menu item. |
LgAccountMenuListItemComponent
| Output | Type | Description |
|---|---|---|
clicked | EventEmitter<Event> | Emitted when a click event bubbles up to the list item. |
tabbedOut | EventEmitter<KeyboardEvent> | Emitted when the tab key bubbles up to the list item. |
LgNotificationBadgeComponent
| Input | Type | Default | Required | Description |
|---|---|---|---|---|
count | number | undefined | No | The numeric value to display in the badge when variant is 'count'. |
accessText | string | undefined | No | Accessible text for assistive technologies. |
variant | 'count' | 'dot' | 'count' | No | Badge variant. Use 'dot' for an indeterminate indicator instead of a count. |
Apply lgMenuBadge to the lg-notification-badge element to display it on the mobile menu toggle button.
Dos and Don'ts
Do
- Do always provide both
lgPrimaryNavMobileItemand desktoplg-primary-nav-list-itementries — the navigation does not auto-derive mobile items from desktop items. - Do project
lgAccountMenuMobileItemanchors insidelg-primary-nav— they appear in the mobile nav dropdown, not inlg-account-menu. - Do use
lg-account-menuitems for the header bar (visible on both mobile and desktop next to the burger menu). - Do wrap mobile items in
lg-link-menu-item/lg-link-menu-item-textstructure. - Do keep navigation items to around six maximum to avoid overcrowding.
- Do use
lgMenuBadgeonlg-notification-badgeto show a badge on the mobile burger menu button.
Don't
- Don't apply
lg-headeras a component tag — it is an attribute selector and must be applied to a native<header>element. - Don't expect mobile navigation to be auto-generated — all mobile items must be explicitly authored.
- Don't place
lgAccountMenuMobileItemitems insidelg-account-menu— they must be insidelg-primary-nav.
Migration from Previous Navigation
The navigation was rebuilt with explicit mobile/desktop slots. Key changes:
- Mobile items are no longer derived automatically — provide
lgPrimaryNavMobileItemandlgAccountMenuMobileItemexplicitly. - Import
LgPrimaryNavMobileItemDirective,LgAccountMenuMobileItemDirective,LgLinkMenuItemComponent, andLgLinkMenuItemTextComponentin your component'simportsarray.
Signals
- GitHub stars
- 23
- Forks
- 46
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
canopy-header- Source
- github.com/legal-and-general/canopy