canopy-heading

Explain dynamic heading level best practices for LgHeadingComponent in Angular.

23|46|Updated Sep 7, 2020
One-click install
npx skills add https://github.com/Legal-and-General/canopy --skill canopy-heading
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: canopy-heading
Source: https://github.com/Legal-and-General/canopy/tree/main/skills/best-practice/heading
Command: npx skills add https://github.com/Legal-and-General/canopy --skill canopy-heading

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Dynamically setting the semantic heading level in Angular components can break accessibility and document structure if not handled correctly.

Core Features & Use Cases

  • Provides guidance for using the LgHeadingComponent inside wrappers to allow dynamic heading levels while preserving a logical document outline.
  • Illustrates best practices to avoid static headings and to maintain accessibility across interactive components like accordions and cards.
  • Includes real-world usage examples and pitfalls to avoid when rendering programmatic headings.

Quick Start

Explain how to render a dynamic heading level inside a custom component using Canopy.

Frequently Asked Questions about canopy-heading

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I render dynamic heading levels in Angular components without breaking accessibility?▼

To render dynamic heading levels safely in Angular, use the LgHeadingComponent to expose a level input. This preserves the logical document outline and ensures accessibility when heading ranks adjust inside wrappers.

Why does setting a static heading level inside an accordion break the document outline?▼

Static heading levels break the document outline because nested interactive components like accordions alter the semantic hierarchy. Exposing a dynamic level input allows consumer wrappers to adjust the heading rank to maintain accessibility.

What's the best way to adjust heading levels inside Angular cards and accordions?▼

The best way to adjust heading levels inside Angular cards and accordions is to pass a dynamic level input to the heading component. This allows the consumer wrapper to set the correct semantic rank for a logical document outline.

Can I use the Canopy heading component to maintain a logical document outline in Angular?▼

Yes, you can use the Canopy LgHeadingComponent to maintain a logical document outline. It provides a level input that consumer wrappers can bind to dynamically, ensuring the correct semantic heading rank renders across interactive components.

What are the pitfalls of rendering programmatic headings in Angular?▼

Pitfalls of rendering programmatic headings include using static levels inside dynamic wrappers, which disrupts the document outline. Avoid this by exposing a level input on custom components to ensure the correct semantic rank is always set.

Do I need a dynamic level input for accessibility when building Angular components?▼

You need a dynamic level input for accessibility when building Angular components if the heading rank depends on the context. Wrappers like accordions require adjustable levels to maintain a logical document outline and meet accessibility standards.