- Type-ahead support for Angular components: Get coding faster with smart suggestions directly in your IDE.
- New features and properties added across existing components: More flexibility, and improved accessibility.
- New components available: Build more complex interfaces with less custom code.
- Improved error checking during builds: Catch issues earlier for a smoother development experience.
GoA to Goab, while in Angular, it changes from goa- to goab-. See the following examples:React
GoAButtonwill beGoabButtonGoAContainerwill beGoabContainer
Angular
goa-buttonwill begoab-buttongoa-containerwill begoab-container
- Updating versions – two ways to install the latest packages
- Renaming components – update old names to new names
- Updating component props – adjust component properties and clean up warnings
Migrating a React app
@abgov/react-components package.npm i @abgov/web-components@latest
npm i @abgov/react-components@latestGoAName to GoabNameGoA-- with Goab-- for all component names. For example:// Before
import {GoAAccordion, GoAButton, GoACallout, GoAHeadingSize } from '@abgov/react-components';
// After
import {GoabAccordion, GoabButton, GoabCallout, GoabAccordionHeadingSize} from '@abgov/react-components';| Component | v5 | v6(latest) |
|---|---|---|
| Block |
|
|
| Checkbox |
|
|
| Date picker |
|
|
| Dropdown |
|
|
| File uploader |
|
|
| File uploader input |
|
|
| Form stepper |
|
|
| Input |
|
|
| Modal |
|
|
| Pagination |
|
|
| Popover |
|
|
| Radio group |
|
|
| Spacer |
|
|
| Table |
|
|
| Tabs |
|
|
| Text area |
|
|
| Calendar |
|
|
| Spinner |
|
|
Migrating an Angular app
@abgov/angular-components supports only Angular v16 and above.npm i @abgov/web-components@latest
npm i @abgov/angular-components@latest// Before
import { Component, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
@Component({
selector: "app-accordion",
standalone: true,
templateUrl: "./accordion.component.html",
schemas: [CUSTOM_ELEMENTS_SCHEMA] // Required for v3 but will be removed in v4
})
export class AccordionComponent {}
// After
import {GoabAccordion, GoabButton, GoabBadge} from '@abgov/angular-components';
@Component({
selector: "app-accordion",
standalone: true,
imports: [GoabAccordion, GoabButton, GoabBadge],
templateUrl: "./accordion.component.html"
})
export class AccordionComponent {}goa-name to goab-name in HTML templatesgoa- to goab-, with the following exceptions:- TwoColumnLayout: remains
goa-two-column-layout - ThreeColumnLayout: remains
goa-three-column-layout
goa-one-column-layout component has been renamed to goab-column-layoutgoa- to goab- for all component names. For example:<!--Before-->
<goa-circular-progress variant="inline" size="small" visible="true"></goa-circular-progress>
<goa-accordion heading="Heading" [open]="open"> Content 1</goa-accordion>
<goa-button (_click)="onClick()" type="tertiary">Tertiary</goa-button>
// After
<goab-circular-progress variant="inline" size="small" [visible]="true"></goab-circular-progress>
<goab-accordion heading="Heading" [open]="open"> Content 1 </goab-accordion>
<goab-button (onClick)="onClick()" type="tertiary">Tertiary</goab-button>string. Now, these margin properties are categorized under Spacing, ensuring consistency:| Property Name | v3 | v4 |
|---|---|---|
mt | string | Spacing |
mb | string | Spacing |
ml | string | Spacing |
mr | string | Spacing |
headingsize is now headingSize.string or boolean. In version 4, we introduced custom types for these properties and function arguments to ensure that the type checker validates the data structure specific to our components. You can find these changes detailed in the tables below:| Component | v3 | v4 |
|---|---|---|
| Accordion |
|
|
| Badge |
|
|
| Block |
|
|
| Button |
|
|
| Button group |
|
|
| Callout |
|
|
| Checkbox |
|
|
| Chip |
|
|
| Container |
|
|
| Date picker |
|
|
| Dropdown |
|
|
| File uploader |
|
|
| File uploader input |
|
|
| App Footer Nav Section |
|
|
| App Footer Meta Section |
|
|
| Form item |
|
|
| Form stepper |
|
|
| Form step |
|
|
| Grid |
|
|
| Hero banner |
|
|
| Icons |
|
|
| Icon button |
|
|
| Input |
|
|
| Microsite header |
|
|
| Modal |
|
|
| Notification banner |
|
|
| Pagination |
|
|
| Popover |
|
|
| Progress indicator |
|
|
| Radio item |
|
|
| Radio group |
|
|
| Side menu heading |
|
|
| Skeleton loading |
|
|
| Spacer |
|
|
| Table |
|
|
| Table sort header |
|
|
| Tab item |
|
|
| Tabs |
|
|
| Text area |
|
|
| Tooltip |
|
|
| AppHeaderMenu |
|
|
| Calendar |
|
|
| PageBlock |
|
|
| Spinner |
|
|
slot="name" to reference a property. For example,<!--Before-->
<goa-popover>
<p>This is a popover</p>
It can be used for a number of different contexts.
<!--Slot target is required but can be forgotten because there are no errors alerted if we miss it-->
<div slot="target">
<goa-button type="secondary" size="compact">Click me</goa-button>
</div>
</goa-popover>
<!--After-->
<!-- target property is required for goab-popover -->
<goab-popover target="popOverTarget">
<p>This is a popover</p>
It can be used for a number of different contexts.
<ng-template #popOverTarget>
<goab-button type="secondary" size="compact">Click me</goab-button>
</ng-template>
</goab-popover>slot replaced by Angular ng-template references:| Component | v3 | v4 |
|---|---|---|
| Accordion |
|
|
| Checkbox |
|
|
| Container |
|
|
| Hero banner |
|
|
| Modal |
|
|
| Popover |
|
|
| Radio item |
|
|
| Side menu heading |
|
|
| Tab item |
|
|
goaValue and goaChecked from the Angular input componentsgoaValue and goaChecked directives can be removed from our input components when using Angular Forms. This applies to the following components:- Checkbox
- Date picker
- Dropdown
- Input
- Radio
- Textarea
1. Reactive
import { GoabCheckbox } from "@abgov/angular-components";
import { Component } from "@angular/core";
import { FormBuilder, FormGroup, ReactiveFormsModule } from "@angular/forms";
@Component({
standalone: true,
selector: "abgov-checkbox",
templateUrl: "./checkbox.component.html",
imports: [
GoABCheckbox,
ReactiveFormsModule
]
})
class CheckboxComponent {
form!: FormGroup;
constructor(private fb: FormBuilder) {
this.form = this.fb.group({
checked: [false]
});
}
}<form [formGroup]="form">
<goab-checkbox formControlName="checked" text="Item"></goab-checkbox>
</form>2. Template-driven
import { GoabCheckbox } from "@abgov/angular-components";
import { Component } from "@angular/core";
import { FormsModule } from "@angular/forms";
@Component({
standalone: true,
selector: "abgov-checkbox",
templateUrl: "./checkbox.component.html",
imports: [
GoabCheckbox,
FormsModule,
]
})
class CheckboxComponent {
checked = false;
}<form>
<goab-checkbox [(ngModel)]="checked" text="Item"></goab-checkbox>
</form>3. Event handler
import { GoabCheckbox, GoabCheckboxOnChangeDetail } from "@abgov/angular-components";
import { Component } from "@angular/core";
@Component({
standalone: true,
selector: "abgov-checkbox",
templateUrl: "./checkbox.component.html",
imports: [
GoABCheckbox
]
})
class CheckboxComponent {
checked = false;
onChange(event: GoabCheckboxOnChangeDetail) {
this.checked = event.checked;
}
}<goab-checkbox name="item" text="Item" [value]="checked" (onChange)="onChange($event)"></goab-checkbox>Book time in drop in hours