Canopy Card — Best Practices
This skill provides usage guidance and input reference for the Canopy lg-card component and related patterns from @legal-and-general/canopy.
Apply this skill whenever you use lg-card or any LgCard* component.
Import
import {
LgCardComponent,
LgCardContentComponent,
LgCardHeaderComponent,
LgCardFooterComponent,
LgCardTitleComponent,
LgCardSubtitleComponent,
LgCardSubheadingComponent,
LgCardNavigationTitleComponent,
LgCardGroupComponent,
LgCardToggableContentComponent,
LgCardContentInnerDataPointsComponent,
LgCardHeroImageComponent,
} from '@legal-and-general/canopy';
Basic Usage
<lg-card>
<lg-card-content>
Your content here. <a href="#">Test link</a>.
</lg-card-content>
</lg-card>
Card with Title
<lg-card>
<lg-card-header>
<lg-card-title [headingLevel]="2">Card Title</lg-card-title>
</lg-card-header>
<lg-card-content>
<p>Card body text.</p>
</lg-card-content>
</lg-card>
Footer Actions
lg-card-footer accepts lg-button-group, a, button and lg-link-menu as direct children.
- One fixed action: place it directly in the footer. A button group adds nothing for a single action that is always shown.
- Two or more related actions: wrap them in
lg-button-group, with only oneprimary. - An action that is sometimes joined by a second:
lg-button-groupis acceptable, so the layout is the same whether or not the second action is shown. - Use
<button lg-button>for an action on the page, and<a lg-button>withrouterLinkonly when navigating to a route.
<!-- One fixed action -->
<lg-card-footer>
<button lg-button type="button" priority="primary">Continue</button>
</lg-card-footer>
<!-- One fixed action that navigates to a route -->
<lg-card-footer>
<a lg-button priority="primary" routerLink="/next-step">Continue</a>
</lg-card-footer>
<!-- Two related actions -->
<lg-card-footer>
<lg-button-group>
<button lg-button type="button" priority="primary">Continue</button>
<button lg-button type="button" priority="secondary">Back</button>
</lg-button-group>
</lg-card-footer>
Card Patterns
Promo Card
Use the promo variant to display promotional content with a hero image or pictogram. Promo cards should have consistent content length across multiple cards for better visual alignment.
Hero image and pictogram layout
The lg-card-hero-img element is always placed first in the DOM (before lg-card-header and lg-card-content). Its position is controlled by orientation:
- Vertical (default): hero image or pictogram sits at the top of the card.
- Horizontal: in
LgCardComponent, the hero image or pictogram is positioned on the right of the card body.
On the default variant in horizontal layout, a pictogram is absolutely positioned on the right of the card body and card content automatically receives extra right padding to prevent text overlap.
Promotion Card with Hero Image
<lg-card
lgMarginBottom="6"
lgPadding="none"
variant="promo"
[lgOrientation]="{ sm: 'vertical', md: 'horizontal', lg: 'horizontal' }">
<lg-card-hero-img [cover]="true" [src]="imageUrl"></lg-card-hero-img>
<lg-card-content>
<h3 lgMarginBottom="2" class="lg-font--expressive">{{ title }}</h3>
<p lgMarginBottom="6">{{ description }}</p>
<a href="#">{{ linkText }}</a>
</lg-card-content>
</lg-card>
Promotion Card with Pictogram
Use a pictogram instead of an image for promotional content:
<lg-card
lgMarginBottom="6"
variant="promo"
[lgOrientation]="{ sm: 'vertical', md: 'horizontal', lg: 'horizontal' }">
<lg-card-hero-img>
<lg-pictogram [name]="iconName" size="lg" [hasFill]="false"></lg-pictogram>
</lg-card-hero-img>
<lg-card-content>
<h3 lgMarginBottom="2" class="lg-font--expressive">{{ title }}</h3>
<p lgMarginBottom="6">{{ description }}</p>
<a href="#">{{ linkText }}</a>
</lg-card-content>
</lg-card>
Promotion Layout: Single Card
<div lgContainer>
<div lgRow>
<div lgColSm="12">
<lg-card
lgMarginBottom="6"
lgPadding="none"
variant="promo"
[lgOrientation]="{ sm: 'vertical', md: 'horizontal', lg: 'horizontal' }">
<lg-card-hero-img [cover]="true" [src]="imageUrl"></lg-card-hero-img>
<lg-card-content>
<h3 lgMarginBottom="2" class="lg-font--expressive">{{ title }}</h3>
<p lgMarginBottom="6">{{ description }}</p>
<a href="#">{{ linkText }}</a>
</lg-card-content>
</lg-card>
</div>
</div>
</div>
Promotion Layout: Two Cards
<div lgContainer>
<div lgRow>
<div lgColSm="12" lgColLg="6">
<lg-card
lgMarginBottom="6"
lgPadding="none"
variant="promo"
[lgOrientation]="{ sm: 'vertical', md: 'horizontal', lg: 'vertical' }">
<lg-card-hero-img [cover]="true" [src]="imageUrl"></lg-card-hero-img>
<lg-card-content>
<h3 lgMarginBottom="2" class="lg-font--expressive">{{ title }}</h3>
<p lgMarginBottom="6">{{ description }}</p>
<a href="#">{{ linkText }}</a>
</lg-card-content>
</lg-card>
</div>
<div lgColSm="12" lgColLg="6">
<!-- Second card with same structure -->
</div>
</div>
</div>
Promotion Layout: Three Cards
<div lgContainer>
<div lgRow>
<div lgColSm="12" lgColLg="4">
<lg-card
lgMarginBottom="6"
lgPadding="none"
variant="promo"
[lgOrientation]="{ sm: 'vertical', md: 'horizontal', lg: 'vertical' }">
<lg-card-hero-img [cover]="true" [src]="imageUrl"></lg-card-hero-img>
<lg-card-content>
<h3 lgMarginBottom="2" class="lg-font--expressive">{{ title }}</h3>
<p lgMarginBottom="6">{{ description }}</p>
<a href="#">{{ linkText }}</a>
</lg-card-content>
</lg-card>
</div>
<!-- Repeat for remaining cards -->
</div>
</div>
Promotion Layout: Magazine (Mixed Image and Pictogram)
For magazine-style layouts with a separator, combine image and pictogram promotions:
<div lgContainer>
<div lgRow>
<div lgCol="12">
<lg-separator variant="dotted" lgMarginTop="none"></lg-separator>
</div>
<!-- Three cards with images -->
<div lgColSm="12" lgColLg="4">
<!-- Card with hero image -->
</div>
<!-- Continue with 2 more image cards -->
</div>
<div lgRow>
<div lgCol="12">
<lg-separator variant="dotted" lgMarginTop="none"></lg-separator>
</div>
<!-- Two cards with pictograms -->
<div lgColSm="12" lgColLg="6">
<lg-card
lgMarginBottom="6"
variant="promo"
[lgOrientation]="{ sm: 'vertical', md: 'horizontal', lg: 'vertical' }">
<lg-card-hero-img>
<lg-pictogram [name]="iconName" size="lg" [hasFill]="false"></lg-pictogram>
</lg-card-hero-img>
<lg-card-content>
<h3 lgMarginBottom="2" class="lg-font--expressive">{{ title }}</h3>
<p lgMarginBottom="6">{{ description }}</p>
<a href="#">{{ linkText }}</a>
</lg-card-content>
</lg-card>
</div>
</div>
</div>
Form Journey Card
Place the <form> element as a parent of <lg-card>. Form inputs go in <lg-card-content> and the submit button goes in <lg-card-footer>:
<form (ngSubmit)="onSubmit()">
<lg-card>
<lg-card-content>
<!-- form fields -->
</lg-card-content>
<lg-card-footer>
<button lg-button type="submit" priority="primary">Submit</button>
</lg-card-footer>
</lg-card>
</form>
Navigation Card
Use LgCardNavigationTitleComponent inside lg-card-header with the interactive variant. The link target and icon are automatically determined from the link input:
<lg-card variant="interactive">
<lg-card-header>
<lg-card-navigation-title
[headingLevel]="3"
title="Go to next page"
link="/next-page">
</lg-card-navigation-title>
</lg-card-header>
<lg-card-content>
<p>Card body text.</p>
</lg-card-content>
</lg-card>
Card with Data Points
Wrap data-point components in LgCardContentInnerDataPointsComponent for correct layout:
<lg-card>
<lg-card-content>
<lg-card-content-inner-data-points>
<lg-data-point>...</lg-data-point>
</lg-card-content-inner-data-points>
</lg-card-content>
</lg-card>
Card Group
Wrap multiple cards in an element with the lg-card-group attribute inside a lgCol="12" column:
<div lgContainer>
<div lgRow>
<div [lgCol]="12">
<aside lg-card-group>
<lg-card>...</lg-card>
<lg-card>...</lg-card>
</aside>
</div>
</div>
</div>
Show More Card
Use LgCardToggableContentComponent with the lgButtonToggle directive:
<lg-card>
<lg-card-content>
<p>Always visible content.</p>
<lg-card-toggable-content [isActive]="isToggleActive">
<p>Hidden content revealed on toggle.</p>
</lg-card-toggable-content>
<button lgButtonToggle (toggleActive)="toggleActive($event)">Show more</button>
</lg-card-content>
</lg-card>
Inputs
| Input | Type | Default | Description |
|-------------|---------------|---------------|------------------------------------------------------------------------|
| variant | CardVariant | 'default' | The card variant — 'default', 'promo', or 'interactive'. |
Dos and Don'ts
Do
- Do ensure that content relates to a single idea or concept.
- Do summarise content and provide links to expanded content on child pages.
- Do use when each card will contain different types of content.
- Do place cards directly on the page background.
- Do create layouts that make the hierarchy of the page clearly understood.
- Do keep promotional message content succinct — follow content guidelines (title max 33 chars, description max 140 chars, link max 20 chars).
- Do use the
interactivecard variant for navigation cards and preferLgCardNavigationTitleComponentinlg-card-header.
Don't
- Don't overfill or cover more than one subject within a card.
- Don't use cards as a replacement for standard pages.
- Don't place cards on top of cards.
- Don't use to build complex, cluttered layouts that obscure page structure.
- Don't mix image and pictogram promotions within the same card layout section.
Variant and orientation notes
LgCardComponentsupportsvariant="default" | "promo" | "interactive".- If
LgCardNavigationTitleComponentis projected, the card switches to interactive behaviour automatically. - Card examples and styles support
verticalandhorizontalorientation values only. LgOrientationDirectivealso definesreverse-horizontalandreverse-verticalvalues at the shared type level, but those reverse orientations are unsupported for cards.
Component reference
LgCardComponent
Main card container. Accepts variant input (default, promo, interactive).
LgCardHeroImageComponent
Contains hero image or pictogram content.
Inputs: cover (boolean, default false), src (string), alt (string, default '').
LgCardNavigationTitleComponent
Navigation title and link component for interactive cards.
Inputs: headingLevel, title, link, queryParams, queryParamsHandling.
Outputs: linkClickedEvent.
LgCardContentInnerDataPointsComponent
Tertiary layout section for arranging data points in card content.
LgCardGroupComponent
Attribute directive ([lg-card-group]) to group 2+ cards with equal heights across breakpoints.