Details

From Legal-and-General/canopy · View interactive version

Details is an AI agent skill from the GitHub repository Legal-and-General/canopy. Best practices for the Canopy Details component. Trigger when adding a single collapsible section, an FAQ-style disclosure, or a status-coloured details panel in an Angular project using Canopy.

How to use this skill

Skill file

Canopy Details — Best Practices

This skill provides usage guidance, dos and don'ts, and input reference for the Canopy lg-details component from @legal-and-general/canopy.

Apply this skill whenever you use LgDetailsComponent, LgDetailsPanelHeadingComponent, lg-details, or lg-details-panel-heading.


Import

import {
  LgDetailsComponent,
  LgDetailsPanelHeadingComponent,
} from '@legal-and-general/canopy';

Add both components to your module imports or a standalone component's imports array.


Basic Usage

<lg-details>
  <lg-details-panel-heading [headingLevel]="3">
    How do I change my payment details?
  </lg-details-panel-heading>
  Give us a call on 0800 123 4567 and we'll be happy to help you change your payment
  details.
</lg-details>

Statuses

Use generic for most cases. Use other statuses sparingly when you need the panel itself to communicate severity or emphasis.

| Status | When to use |

|--------|-------------|

| generic | Default. Neutral disclosure. |

| info | Highlight informational context. |

| warning | Warn about something that may affect the user. |

| error | Signal an error in context. |

| success | Confirm a successful outcome. |

warning, error, and success automatically add role="alert". This causes assistive technologies to announce the content as an alert when it appears, so only use those statuses when that behaviour is appropriate.

For icons:

Information status with a custom icon:

<lg-details status="info" icon="information-filled">
  <lg-details-panel-heading [headingLevel]="3">
    You have triggered the Money Purchase Annual Allowance (MPAA)
  </lg-details-panel-heading>
  You have flexibly accessed benefits from a pension, which may or may not be held with
  Legal & General.
</lg-details>

Inputs

| Input | Type | Default | Required | Description |

|-------|------|---------|----------|-------------|

| isActive | boolean | false | No | Whether the panel is expanded. |

| status | 'generic' \| 'info' \| 'warning' \| 'error' \| 'success' | 'generic' | No | Applies status treatment and ARIA role if applicable. |

| showIcon | boolean | true | No | Whether to show the status icon. |

| icon | IconName | 'globe' | No | Custom icon for generic and info statuses only. |

LgDetailsPanelHeadingComponent Inputs

| Input | Type | Default | Required | Description |

|-------|------|---------|----------|-------------|

| headingLevel | 1 \| 2 \| 3 \| 4 \| 5 \| 6 | n/a | Yes | Semantic heading level for the button label. |

Outputs

| Output | Type | Description |

|--------|------|-------------|

| opened | EventEmitter<void> | Emitted when the panel opens. |

| closed | EventEmitter<void> | Emitted when the panel closes. |


Dos and Don'ts

Do

  1. Do use Details to hide secondary information that helps some users but is not essential for everyone to see immediately.
  2. Do keep the heading short and descriptive so users can decide quickly whether to expand it.
  3. Do match the width of the Details panel to the content it sits with so it feels like part of the same reading flow.
  4. Do keep the content small and simple. Links and simple imagery are acceptable, but the component is intended for brief supporting content.

Don't

  1. Don't use Details for large amounts of content or rich media such as audio or video.
  2. Don't hide key information that is important or relevant to most users. Put that content on the page instead.
  3. Don't use a Details panel to gate a required action such as confirming terms and conditions before a user can continue. <!-- from documentation image -->
  4. Don't stack multiple coloured status variants together as a substitute for clearer page structure. Use status treatments sparingly, and default to generic. <!-- from documentation image -->

Accessibility


Design Constraints


When to Use vs Alternatives

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.