Canopy Margin — Best Practices

SkillDev tools

Best practices for the Canopy Margin directive. Trigger when applying margin spacing to Canopy components or HTML elements using the Canopy spacing scale in an Angular project.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Canopy Margin — 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/spacing-margin/SKILL.md and read by ahel’s review.

This skill provides usage guidance and input reference for the Canopy lgMargin directive from @legal-and-general/canopy.

Apply this skill whenever you add margin to a Canopy component or HTML element.

See also: spacing-padding and spacing-row-gap skills.


Import

import { LgMarginDirective } from '@legal-and-general/canopy';

Basic Usage

Apply the directive to any element. Pass a spacing variant number as the value.

<!-- All sides -->
<lg-card lgMargin="4"></lg-card>

<!-- Bottom only -->
<lg-card lgMarginBottom="8"></lg-card>

<!-- Horizontal (left and right) -->
<lg-card lgMarginHorizontal="4"></lg-card>

<!-- Vertical (top and bottom) -->
<lg-card lgMarginVertical="6"></lg-card>

<!-- Combined: all sides 7, but bottom 9 -->
<lg-card lgMargin="7" lgMarginBottom="9"></lg-card>

Breakpoint Overrides (NoneAt)

Set margin to none (zero) at specific breakpoints. Available breakpoints: sm, md, lg, xl, xxl.

<!-- Remove all margin at sm breakpoint -->
<lg-card lgMargin="4" lgMarginNoneAt="sm"></lg-card>

<!-- Remove right margin at md breakpoint -->
<lg-card lgMarginRight="5" lgMarginRightNoneAt="md"></lg-card>

<!-- Remove margin at multiple breakpoints -->
<lg-card lgMargin="7" [lgMarginNoneAt]="['sm', 'lg']"></lg-card>

Inputs

InputTypeDefaultDescription
lgMarginSpacingVariant | SpacingResponsivenullMargin on all sides.
lgMarginTopSpacingVariant | SpacingResponsivenullTop margin.
lgMarginRightSpacingVariant | SpacingResponsivenullRight margin.
lgMarginBottomSpacingVariant | SpacingResponsivenullBottom margin.
lgMarginLeftSpacingVariant | SpacingResponsivenullLeft margin.
lgMarginHorizontalSpacingVariant | SpacingResponsivenullLeft and right margin.
lgMarginVerticalSpacingVariant | SpacingResponsivenullTop and bottom margin.
lgMarginNoneAtBreakpoints | Breakpoints[]nullRemove all margin at breakpoint(s).
lgMarginTopNoneAtBreakpoints | Breakpoints[]nullRemove top margin at breakpoint(s).
lgMarginRightNoneAtBreakpoints | Breakpoints[]nullRemove right margin at breakpoint(s).
lgMarginBottomNoneAtBreakpoints | Breakpoints[]nullRemove bottom margin at breakpoint(s).
lgMarginLeftNoneAtBreakpoints | Breakpoints[]nullRemove left margin at breakpoint(s).
lgMarginHorizontalNoneAtBreakpoints | Breakpoints[]nullRemove horizontal margin at breakpoint(s).
lgMarginVerticalNoneAtBreakpoints | Breakpoints[]nullRemove vertical margin at breakpoint(s).

Design Constraints

  • Always use lgMargin directives instead of writing custom CSS margin — this ensures spacing adheres to the Canopy spacing scale.
  • Spacing variant values (none, 112) map to CSS custom properties defined in spacing.scss.

Signals

GitHub stars
23
Forks
46
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
canopy-spacing-margin
Source
github.com/legal-and-general/canopy
Canopy Margin — Best Practices: Skill · ahel