Canopy Progress Indicator — Best Practices
Use the progress indicator components from @legal-and-general/canopy to show the
progress of a journey, from a simple progress bar to a multi-part form journey.
Apply this skill whenever you use lg-progress-indicator, lg-progress-bar or
lg-progress-header, or import their corresponding components.
Import
import {
LgProgressBarComponent,
LgProgressHeaderComponent,
LgProgressIndicatorComponent,
} from '@legal-and-general/canopy';
Add the components you use to your module imports or standalone component's imports
array.
Basic Usage
Single progress bar
Use the guide's standalone progress bar example, with max and value supplied by
your host component:
<lg-progress-bar [max]="max" [value]="value"></lg-progress-bar>
Form journey
Use the guide's form journey example, with max, value, displayAs and
showProgressBar supplied by your host component:
<lg-progress-indicator
[max]="max"
[value]="value"
[displayAs]="displayAs"
[showProgressBar]="showProgressBar"
>
Journey title
<lg-progress-header> Step Heading </lg-progress-header>
</lg-progress-indicator>
Keep the journey title and lg-progress-header directly inside lg-progress-indicator,
as shown in both the guide and ProgressJourney story.
Display Modes
- Use
displayAswithstep(the default) for a step counter. - Use
displayAswithpercentagefor a percentage display. - Use
showProgressBarto toggle the progress bar; its default istrue. - Use
stepsPrefixto change the step counter's prefix, such as “Step” in “Step 1 of 3”.
Inputs
LgProgressBarComponent
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| max | The number of the maximum steps | number | 0 | Yes |
| value | The current step in the process | number | 0 | Yes |
LgProgressIndicatorComponent
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| max | The number of the maximum steps | number | 0 | Yes |
| value | The current step in the process | number | 0 | Yes |
| displayAs | Display as a step counter or percentage. The percentage is calculated based on the max and min values. | 'percentage' \| 'step' | step | No |
| showProgressBar | Toggle display the progress bar | boolean | true | No |
| stepsPrefix | For a step counter, this changes the text content which describes the steps (e.g. Step 1 of 3). | string | Step | No |
Source conflicts: The guide's
displayAsdescription referencesmin, but nomin
input is documented or exposed. Do not bind a
mininput. The story argTypes list
max/valuedefaults as4/1, while both guide tables and component declarations
specify
0/0; the tables above preserve the guide.
The guide describes three child components, including
lg-progress-journey, but its
consumer example and story project only the title and
lg-progress-header. Follow
the documented nesting above; the guide does not explain this composition distinction.
Usage Rules
- Supply
maxas the number of maximum steps andvalueas the current step, as required
by both documented APIs.
- Use a single
lg-progress-barwhen you only need the progress bar. - Use the full indicator with a journey title and step heading for the documented
multi-part form journey pattern.