Focus

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

Focus is an AI agent skill from the GitHub repository Legal-and-General/canopy. Best practices for the Canopy Focus directive. Trigger when using lgFocus or LgFocusDirective to programmatically control keyboard focus in an Angular project using Canopy.

How to use this skill

Skill file

Canopy Focus — Best Practices

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

Apply this skill when you need to programmatically set focus on a focusable element.


Import

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

Basic Usage

<button [lgFocus]="shouldFocus">Click me</button>

Bind lgFocus to a boolean expression. When the value becomes true, the element receives focus.


Inputs

| Input | Type | Default | Required | Description |

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

| lgFocus | boolean | null | Yes | When true, focus is applied to the element. |

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.