Canopy Text Input — Best Practices
SkillDev toolsBest practices for the Canopy Text Input component. Trigger when adding text input fields, single-line form inputs, prefixes, suffixes, or input buttons in an Angular project using Canopy.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Canopy Text Input — 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/forms-input/SKILL.md and read by ahel’s review.
This skill provides usage guidance, dos and don'ts, and input reference for the Canopy lg-input-field component from @legal-and-general/canopy.
Apply this skill whenever you use LgInputFieldComponent or the lgInput directive.
Import
import { LgInputFieldComponent, LgInputDirective } from '@legal-and-general/canopy';
For hints and validation:
import { LgHintComponent, LgValidationComponent } from '@legal-and-general/canopy';
Basic Usage
Use Angular reactive forms. The lgInput directive goes on the <input> element inside lg-input-field.
<lg-input-field>
Name
<lg-hint>Please enter your full name</lg-hint>
<input lgInput formControlName="name" />
</lg-input-field>
Prefix and Suffix
<!-- Currency prefix -->
<lg-input-field>
Amount
<input lgInput formControlName="amount" />
<span lgPrefix>£</span>
</lg-input-field>
<!-- Percentage suffix -->
<lg-input-field>
Rate
<input lgInput formControlName="rate" />
<span lgSuffix>%</span>
</lg-input-field>
Button Suffix
Use the lgSuffix directive for buttons inside the input border (add-on variant).
<!-- Icon-only add-on button -->
<lg-input-field>
Search
<input lgInput formControlName="query" />
<button lg-button lgSuffix [iconButton]="true" priority="add-on">
Clear
<lg-icon name="close"></lg-icon>
</button>
</lg-input-field>
External Button
Use the lgInputFieldExternalButton directive for buttons outside the input border (e.g., search or submit).
<lg-input-field>
Search
<input lgInput formControlName="query" />
<button lg-button lgInputFieldExternalButton priority="primary">
</button>
</lg-input-field>
You can combine multiple suffixes with an external button:
<lg-input-field>
Amount
<input lgInput formControlName="amount" />
<span lgSuffix>%</span>
<button lg-button lgSuffix [iconButton]="true" priority="add-on">
Clear
<lg-icon name="close" />
</button>
<button lg-button lgInputFieldExternalButton priority="primary">
Submit
</button>
</lg-input-field>
LgInputDirective Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | auto-generated | HTML id attribute. |
name | string | auto-generated, matches id | HTML name attribute. Auto-generated if not provided; defaults to match id. |
LgInputFieldComponent Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | auto-generated | Propagates to the input id and label for. |
block | boolean | false | Makes the input full-width on small screens. |
showLabel | boolean | true | Visually shows or hides the label. |
Dos and Don'ts
Do
- Do always include a label — never rely on placeholder text alone.
- Do keep labels clear, concise, and relevant.
- Do use prefix/suffix variants to clarify the input type (e.g. currency, percentage).
- Do keep input widths relative to the expected length of the content.
Don't
- Don't truncate label text.
- Don't use a text input when a predefined response is required — use the select component instead.
- Don't use a text input for simple yes/no responses — use checkboxes or radio buttons instead.
- Don't use placeholder text as a replacement for a label.
Signals
- GitHub stars
- 23
- Forks
- 46
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
canopy-forms-input- Source
- github.com/legal-and-general/canopy